Require C++ version via cmake features

This works nicely with znc-buildmod because it will now ask cmake to
support at least C++17, but not limit modules to it
This commit is contained in:
Alexey Sokolov
2023-11-18 14:10:22 +00:00
parent 9835f76939
commit 157095fd7c
2 changed files with 2 additions and 9 deletions
-2
View File
@@ -42,8 +42,6 @@ endfunction()
list(APPEND CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/cmake")
include(TestCXX17)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED true)
if(NOT CYGWIN)
# We don't want to use -std=gnu++17 instead of -std=c++17, but among other
# things, -std=c++17 on cygwin defines __STRICT_ANSI__ which makes cygwin
+2 -7
View File
@@ -86,16 +86,11 @@ set_target_properties(znclib PROPERTIES
OUTPUT_NAME "znc"
SOVERSION "${ZNC_VERSION}")
# CMake started supporting metafeature cxx_std_11 only in 3.8
set(required_cxx11_features
cxx_range_for cxx_nullptr cxx_override
cxx_lambdas cxx_auto_type)
target_compile_features(znc PUBLIC ${required_cxx11_features})
target_compile_features(znclib PUBLIC ${required_cxx11_features})
add_library(ZNC INTERFACE)
target_link_libraries(ZNC INTERFACE ${znc_link} ${zncpubdeps})
target_compile_definitions(ZNC INTERFACE "znc_export_lib_EXPORTS")
target_compile_features(ZNC INTERFACE cxx_std_17)
target_compile_features(znclib PUBLIC cxx_std_17)
if(HAVE_I18N)
add_subdirectory(po)