diff options
author | Rolf Eike Beer <eike@sf-mail.de> | 2018-03-19 20:42:25 (GMT) |
---|---|---|
committer | Rolf Eike Beer <eike@sf-mail.de> | 2018-04-03 18:56:28 (GMT) |
commit | f38d05023125803d42a6535dfc11c6de4041e28d (patch) | |
tree | 05f179a499a331dfba8bcdecb9f4dba915dda32c /Tests/Module | |
parent | 561238bb6f07a5ab31293928bd98f6f8911d8bc1 (diff) | |
download | CMake-f38d05023125803d42a6535dfc11c6de4041e28d.zip CMake-f38d05023125803d42a6535dfc11c6de4041e28d.tar.gz CMake-f38d05023125803d42a6535dfc11c6de4041e28d.tar.bz2 |
WCDH: introduce BARE_FEATURES
This allows defining compat versions of some C/C++ features with the name of the
keyword itself, so all code can look as if it was written for the new language
standard.
Diffstat (limited to 'Tests/Module')
-rw-r--r-- | Tests/Module/WriteCompilerDetectionHeader/CMakeLists.txt | 15 | ||||
-rw-r--r-- | Tests/Module/WriteCompilerDetectionHeader/main_bare.cpp | 23 |
2 files changed, 37 insertions, 1 deletions
diff --git a/Tests/Module/WriteCompilerDetectionHeader/CMakeLists.txt b/Tests/Module/WriteCompilerDetectionHeader/CMakeLists.txt index 52d4613..45bb229 100644 --- a/Tests/Module/WriteCompilerDetectionHeader/CMakeLists.txt +++ b/Tests/Module/WriteCompilerDetectionHeader/CMakeLists.txt @@ -190,7 +190,7 @@ write_compiler_detection_header( ALLOW_UNKNOWN_COMPILERS ) -# intentionally abuse the TEST_NULLPR variable: this will only work +# intentionally abuse the TEST_NULLPTR variable: this will only work # with the fallback code. check_cxx_source_compiles("#include \"${CMAKE_CURRENT_BINARY_DIR}/test_compiler_detection_allow_unknown.h\" int main() {\n int i = TEST_NULLPTR;\n return 0; }\n" @@ -199,3 +199,16 @@ int main() {\n int i = TEST_NULLPTR;\n return 0; }\n" if (NOT file_include_works_allow_unknown) message(SEND_ERROR "Inclusion of ${CMAKE_CURRENT_BINARY_DIR}/test_compiler_detection_allow_unknown.h was expected to work, but did not.") endif() + +# test for BARE_FEATURES + +write_compiler_detection_header( + FILE "${CMAKE_CURRENT_BINARY_DIR}/test_compiler_detection_bare_features.h" + PREFIX TEST + COMPILERS GNU Clang AppleClang MSVC SunPro Intel + VERSION 3.1 + BARE_FEATURES cxx_nullptr cxx_override cxx_noexcept cxx_final +) + +add_executable(WriteCompilerDetectionHeaderBareFeatures main_bare.cpp) +set_property(TARGET WriteCompilerDetectionHeaderBareFeatures PROPERTY CXX_STANDARD 11) diff --git a/Tests/Module/WriteCompilerDetectionHeader/main_bare.cpp b/Tests/Module/WriteCompilerDetectionHeader/main_bare.cpp new file mode 100644 index 0000000..6954318 --- /dev/null +++ b/Tests/Module/WriteCompilerDetectionHeader/main_bare.cpp @@ -0,0 +1,23 @@ +#include "test_compiler_detection_bare_features.h" + +class base +{ +public: + virtual ~base() {} + virtual void baz() = 0; +}; + +class foo final +{ +public: + virtual ~foo() {} + char* bar; + void baz() noexcept override { bar = nullptr; } +}; + +int main() +{ + foo f; + + return 0; +} |