Build: Work around CMake version on Xenial not supporting cxx_std_* flags

Closes #3146
This commit is contained in:
Peter Keresztes Schmidt 2021-02-09 13:10:43 +01:00
parent 11d6de1aca
commit 4ebfbdef5d
1 changed files with 11 additions and 4 deletions

View File

@ -1,13 +1,20 @@
add_library(zm-compile-option-interface INTERFACE) add_library(zm-compile-option-interface INTERFACE)
# Use -std=c++11 instead of -std=gnu++11 # Use -std=c++11 instead of -std=gnu++11
set(CXX_EXTENSIONS OFF) set(CMAKE_CXX_EXTENSIONS OFF)
add_library(zm-feature-interface INTERFACE) add_library(zm-feature-interface INTERFACE)
target_compile_features(zm-feature-interface # The cxx_std_* feature flags were only introduced in CMake 3.8
INTERFACE # Use to old way to specify the required standard level for older CMake versions.
cxx_std_11) # 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 # Interface to set warning levels on targets
# It gets populated in the compiler specific script # It gets populated in the compiler specific script