Skip to content

Commit 9cd79d4

Browse files
committed
[C++] Set C++ standard using idiomatic approach.
1 parent 91ad0c1 commit 9cd79d4

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

CMakeLists.txt

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,14 @@ if(NOT CMAKE_BUILD_TYPE)
4444
set(CMAKE_BUILD_TYPE "Release" CACHE STRING "Choose the type of build" FORCE)
4545
endif(NOT CMAKE_BUILD_TYPE)
4646

47+
if(NOT DEFINED CMAKE_CXX_STANDARD)
48+
set(CMAKE_CXX_STANDARD 11)
49+
endif()
50+
51+
if(NOT DEFINED CMAKE_CXX_EXTENSIONS)
52+
set(CMAKE_CXX_EXTENSIONS OFF)
53+
endif()
54+
4755
if(SBE_TESTS)
4856
set(SBE_THIRDPARTY_BINARY_DIR "${CMAKE_CURRENT_BINARY_DIR}/thirdparty")
4957

@@ -73,7 +81,7 @@ endif()
7381
find_package(Threads)
7482

7583
if(UNIX)
76-
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -fexceptions -g -Wall -Wpedantic -Wextra -Wno-unused-parameter")
84+
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fexceptions -g -Wall -Wpedantic -Wextra -Wno-unused-parameter")
7785
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -O0")
7886
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -Ofast")
7987
endif()

0 commit comments

Comments
 (0)