diff --git a/cmake/Modules/ConfigureBaseTargets.cmake b/cmake/Modules/ConfigureBaseTargets.cmake index 5f9a583af..50589ccd1 100644 --- a/cmake/Modules/ConfigureBaseTargets.cmake +++ b/cmake/Modules/ConfigureBaseTargets.cmake @@ -1,13 +1,20 @@ add_library(zm-compile-option-interface INTERFACE) # Use -std=c++11 instead of -std=gnu++11 -set(CXX_EXTENSIONS OFF) +set(CMAKE_CXX_EXTENSIONS OFF) add_library(zm-feature-interface INTERFACE) -target_compile_features(zm-feature-interface - INTERFACE - cxx_std_11) +# The cxx_std_* feature flags were only introduced in CMake 3.8 +# Use to old way to specify the required standard level for older CMake versions. +# Remove this once we raise the required CMake version. +if(${CMAKE_VERSION} VERSION_LESS 3.8.0) + set(CMAKE_CXX_STANDARD 11) +else() + target_compile_features(zm-feature-interface + INTERFACE + cxx_std_11) +endif() # Interface to set warning levels on targets # It gets populated in the compiler specific script