Skip to content

Commit 3314aa4

Browse files
committed
Allow the user to set the C++ standard to use
This is useful to test the library at different standard levels. Currently doesn't search for C++14 in 'auto' mode. Can enable in the future
1 parent 8b50160 commit 3314aa4

File tree

1 file changed

+6
-8
lines changed

1 file changed

+6
-8
lines changed

CMakeLists.txt

+6-8
Original file line numberDiff line numberDiff line change
@@ -18,18 +18,16 @@ message("-- Version: ${VERSION}")
1818
set(GENERIC_LIB_VERSION ${VERSION})
1919
string(SUBSTRING ${VERSION} 0 1 GENERIC_LIB_SOVERSION)
2020

21-
# Try and enable C++11. Don't use C++14 because it doesn't work in some
22-
# configurations.
21+
# Import our CMake modules
2322
include(CheckCXXCompilerFlag)
2423
include(AddCXXCompilerFlag)
2524
include(CXXFeatureCheck)
2625

27-
check_cxx_compiler_flag(-std=c++11 HAVE_FLAG_CXX_11)
28-
check_cxx_compiler_flag(-std=c++0x HAVE_FLAG_CXX_0X)
29-
if (HAVE_FLAG_CXX_11)
30-
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
31-
elseif (HAVE_FLAG_CXX_0X)
32-
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x")
26+
# Try and enable C++11. Don't use C++14 because it doesn't work in some
27+
# configurations.
28+
add_cxx_compiler_flag(-std=c++11)
29+
if (NOT HAVE_CXX_FLAG_STD_CXX11)
30+
add_cxx_compiler_flag(-std=c++0x)
3331
endif()
3432

3533
# Turn compiler warnings up to 11

0 commit comments

Comments
 (0)