diff options
author | Brad King <brad.king@kitware.com> | 2017-05-22 14:35:08 (GMT) |
---|---|---|
committer | Kitware Robot <kwrobot@kitware.com> | 2017-05-22 14:35:30 (GMT) |
commit | a748916f5e14687e31d2bd6d7dab5a8d5b7aa2b3 (patch) | |
tree | 074564e8558cdefbff5957b4be485ab7cf34f960 /Source | |
parent | 1b7c18a2f36c30182330c0a937760b09a89635c5 (diff) | |
parent | f74f01fe69a30f0b343c1b80e564cd4518c10f26 (diff) | |
download | CMake-a748916f5e14687e31d2bd6d7dab5a8d5b7aa2b3.zip CMake-a748916f5e14687e31d2bd6d7dab5a8d5b7aa2b3.tar.gz CMake-a748916f5e14687e31d2bd6d7dab5a8d5b7aa2b3.tar.bz2 |
Merge topic 'cxx-features-check-always'
f74f01fe Check C++ features even without CMAKE_CXX_STANDARD for CMake itself
Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !870
Diffstat (limited to 'Source')
-rw-r--r-- | Source/Checks/cm_cxx_features.cmake | 29 |
1 files changed, 16 insertions, 13 deletions
diff --git a/Source/Checks/cm_cxx_features.cmake b/Source/Checks/cm_cxx_features.cmake index cd58539..458901e 100644 --- a/Source/Checks/cm_cxx_features.cmake +++ b/Source/Checks/cm_cxx_features.cmake @@ -3,10 +3,15 @@ function(cm_check_cxx_feature name) string(TOUPPER ${name} FEATURE) if(NOT DEFINED CMake_HAVE_CXX_${FEATURE}) message(STATUS "Checking if compiler supports C++ ${name}") + if(CMAKE_CXX_STANDARD) + set(maybe_cxx_standard -DCMAKE_CXX_STANDARD=${CMAKE_CXX_STANDARD}) + else() + set(maybe_cxx_standard "") + endif() try_compile(CMake_HAVE_CXX_${FEATURE} ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_LIST_DIR}/cm_cxx_${name}.cxx - CMAKE_FLAGS -DCMAKE_CXX_STANDARD=${CMAKE_CXX_STANDARD} + CMAKE_FLAGS ${maybe_cxx_standard} OUTPUT_VARIABLE OUTPUT ) # If using the feature causes warnings, treat it as broken/unavailable. @@ -31,16 +36,14 @@ function(cm_check_cxx_feature name) endif() endfunction() -if(CMAKE_CXX_STANDARD) - cm_check_cxx_feature(auto_ptr) - cm_check_cxx_feature(eq_delete) - cm_check_cxx_feature(make_unique) - if(CMake_HAVE_CXX_MAKE_UNIQUE) - set(CMake_HAVE_CXX_UNIQUE_PTR 1) - endif() - cm_check_cxx_feature(nullptr) - cm_check_cxx_feature(override) - cm_check_cxx_feature(unique_ptr) - cm_check_cxx_feature(unordered_map) - cm_check_cxx_feature(unordered_set) +cm_check_cxx_feature(auto_ptr) +cm_check_cxx_feature(eq_delete) +cm_check_cxx_feature(make_unique) +if(CMake_HAVE_CXX_MAKE_UNIQUE) + set(CMake_HAVE_CXX_UNIQUE_PTR 1) endif() +cm_check_cxx_feature(nullptr) +cm_check_cxx_feature(override) +cm_check_cxx_feature(unique_ptr) +cm_check_cxx_feature(unordered_map) +cm_check_cxx_feature(unordered_set) |