diff options
author | Niall Douglas (s [underscore] sourceforge {at} nedprod [dot] com) <spamtrap@nedprod.com> | 2018-06-19 23:16:09 +0300 |
---|---|---|
committer | Niall Douglas (s [underscore] sourceforge {at} nedprod [dot] com) <spamtrap@nedprod.com> | 2018-06-19 23:16:09 +0300 |
commit | f141a3a53fe44c343d8599112f38830016e45044 (patch) | |
tree | e9d49c5da10370e3b141fb65fa9729d67746b711 /CMakeLists.txt | |
parent | 305934b3c3b97e476e018ca6a210df923ad5546a (diff) |
Add single-header sanity check.
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r-- | CMakeLists.txt | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 5feb59e5..fd9a94d6 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -168,8 +168,18 @@ foreach(lib afio_sl afio_dl) target_compile_definitions(${lib} INTERFACE AFIO_HEADERS_ONLY=0) target_compile_definitions(${lib} PRIVATE AFIO_SOURCE=1) endforeach() +set(compiler_has_cxx_17 0) +foreach(feature ${CMAKE_CXX_COMPILE_FEATURES}) + if(feature STREQUAL "cxx_std_17") + set(compiler_has_cxx_17 1) + endif() +endforeach() # The single header test requires C++ 17 -target_compile_features(afio-example_single-header PRIVATE cxx_std_17) +if(compiler_has_cxx_17) + target_compile_features(afio-example_single-header PRIVATE cxx_std_17) +else() + set_target_properties(afio-example_single-header PROPERTIES EXCLUDE_FROM_ALL ON EXCLUDE_FROM_DEFAULT_BUILD ON) +endif() # For all possible configurations of this library, add each test include(QuickCppLibMakeStandardTests) |