From e8ec87abb504744c2cc5d39cb4ba0e48b4f7a1dc Mon Sep 17 00:00:00 2001 From: Marcin Zdun Date: Tue, 15 Sep 2020 21:32:11 +0200 Subject: [PATCH] Compiler/library feature detection --- CMakeLists.txt | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index f9c6aef..ced9492 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -106,12 +106,26 @@ add_library(args STATIC "${CMAKE_CURRENT_BINARY_DIR}/include/args/version.hpp" ) target_compile_options(args PRIVATE ${ADDITIONAL_WALL_FLAGS}) +target_compile_features(args PRIVATE cxx_std_17) target_include_directories(args PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/include ${CMAKE_CURRENT_BINARY_DIR}/include PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/src) +include(CheckCXXSourceCompiles) +function(check_charconv) + check_cxx_source_compiles("#include +int main() {}" HAS_CHARCONV_) + set(HAS_CHARCONV ${HAS_CHARCONV_} PARENT) +endfunction() +check_cxx_source_compiles("#include +int main() {}" HAS_CHARCONV) + +if (NOT HAS_CHARCONV) + message(FATAL_ERROR "The compiler has no access to ") +endif() + ################################################################## ## INSTALL ##################################################################