File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -15,7 +15,8 @@ if(NOT "${CMAKE_VERSION}" VERSION_LESS "3.8")
1515 # Select highest available from list of supported
1616 set (_known_standards 26 23 20 17 14 11)
1717 foreach (std ${_known_standards} )
18- if ("cxx_std_${std} " IN_LIST CMAKE_CXX_COMPILE_FEATURES)
18+ list (FIND CMAKE_CXX_COMPILE_FEATURES "cxx_std_${std} " _index)
19+ if (NOT _index EQUAL -1)
1920 target_compile_features (${target} PRIVATE cxx_std_${std} )
2021 message (STATUS "'${target} ' is using latest available C++ standard: C++${std} " )
2122 return ()
@@ -24,6 +25,13 @@ if(NOT "${CMAKE_VERSION}" VERSION_LESS "3.8")
2425
2526 # Unsupported C++ version
2627 message (FATAL_ERROR "Compiler ${CMAKE_CXX_COMPILER_ID} does not support C++11 or newer." )
28+ else ()
29+ set_target_properties (${target} PROPERTIES
30+ CXX_STANDARD 11
31+ CXX_STANDARD_REQUIRED YES
32+ CXX_EXTENSIONS NO
33+ )
34+ message (STATUS "${target} : Use CMake > 3.8 to automatically use the latest available C++ standard." )
2735endif ()
2836
2937endfunction ()
You can’t perform that action at this time.
0 commit comments