diff options
author | Stephen Kelly <steveire@gmail.com> | 2014-05-15 09:32:30 (GMT) |
---|---|---|
committer | Stephen Kelly <steveire@gmail.com> | 2014-05-21 15:22:32 (GMT) |
commit | 0dfe395e3cb1a720c4853087db554a6827feaadb (patch) | |
tree | 83d9cbe0ee9843bc4aa0012d9a7064a3522ba018 /Tests/CompileFeatures | |
parent | aa8a6fcee8c67b0516efcd745fb1d7a66d249096 (diff) | |
download | CMake-0dfe395e3cb1a720c4853087db554a6827feaadb.zip CMake-0dfe395e3cb1a720c4853087db554a6827feaadb.tar.gz CMake-0dfe395e3cb1a720c4853087db554a6827feaadb.tar.bz2 |
Features: Add COMPILE_FEATURES generator expression.
Allow setting build properties based on the features available
for a target. The availability of features is determined at
generate-time by evaluating the link implementation.
Ensure that the <LANG>_STANDARD determined while evaluating
COMPILE_FEATURES in the link implementation is not lower than that
provided by the INTERFACE of the link implementation. This is
similar to handling of transitive properties such as
POSITION_INDEPENDENT_CODE.
Diffstat (limited to 'Tests/CompileFeatures')
-rw-r--r-- | Tests/CompileFeatures/CMakeLists.txt | 14 | ||||
-rw-r--r-- | Tests/CompileFeatures/genex_test.cpp | 21 |
2 files changed, 35 insertions, 0 deletions
diff --git a/Tests/CompileFeatures/CMakeLists.txt b/Tests/CompileFeatures/CMakeLists.txt index 0e1e6c9..7a8a975 100644 --- a/Tests/CompileFeatures/CMakeLists.txt +++ b/Tests/CompileFeatures/CMakeLists.txt @@ -83,3 +83,17 @@ set_property(TARGET iface ) add_executable(IfaceCompileFeatures main.cpp) target_link_libraries(IfaceCompileFeatures iface) + +add_executable(CompileFeaturesGenex genex_test.cpp) +set_property(TARGET CompileFeaturesGenex PROPERTY CXX_STANDARD 11) +target_compile_definitions(CompileFeaturesGenex PRIVATE HAVE_OVERRIDE_CONTROL=$<COMPILE_FEATURES:cxx_final,cxx_override>) + +add_executable(CompileFeaturesGenex2 genex_test.cpp) +target_compile_features(CompileFeaturesGenex2 PRIVATE cxx_constexpr) +target_compile_definitions(CompileFeaturesGenex2 PRIVATE HAVE_OVERRIDE_CONTROL=$<COMPILE_FEATURES:cxx_final,cxx_override>) + +add_library(noexcept_iface INTERFACE) +target_compile_features(noexcept_iface INTERFACE cxx_noexcept) +add_executable(CompileFeaturesGenex3 genex_test.cpp) +target_link_libraries(CompileFeaturesGenex3 PRIVATE noexcept_iface) +target_compile_definitions(CompileFeaturesGenex3 PRIVATE HAVE_OVERRIDE_CONTROL=$<COMPILE_FEATURES:cxx_final,cxx_override>) diff --git a/Tests/CompileFeatures/genex_test.cpp b/Tests/CompileFeatures/genex_test.cpp new file mode 100644 index 0000000..ca38883 --- /dev/null +++ b/Tests/CompileFeatures/genex_test.cpp @@ -0,0 +1,21 @@ + +#if !HAVE_OVERRIDE_CONTROL +#error "Expect override control feature" +#else + +struct A +{ + virtual int getA() { return 7; } +}; + +struct B final : A +{ + int getA() override { return 42; } +}; + +#endif + +int main() +{ + +} |