mirror of
https://github.com/Kitware/CMake.git
synced 2026-02-17 04:31:04 -06:00
Features: Test cycle diagnostic with language standard meta-feature
The `cxx_static_assert` feature may be available in C++ 98 mode of some compilers or not available at all in others. Intstead of using an individual feature to test cyclic requirement of a feature requiring C++ 11, use the `std_cxx_11` meta-feature that has exactly this meaning.
This commit is contained in:
@@ -3,13 +3,13 @@ add_library(empty1 empty.cpp)
|
|||||||
|
|
||||||
add_library(empty2 INTERFACE)
|
add_library(empty2 INTERFACE)
|
||||||
add_library(empty3 INTERFACE)
|
add_library(empty3 INTERFACE)
|
||||||
target_compile_features(empty3 INTERFACE cxx_static_assert)
|
target_compile_features(empty3 INTERFACE cxx_std_11)
|
||||||
|
|
||||||
target_link_libraries(empty1
|
target_link_libraries(empty1
|
||||||
# When starting, $<COMPILE_FEATURES:cxx_auto_type> is '0', so 'freeze' the
|
# When starting, $<COMPILE_FEATURES:cxx_auto_type> is '0', so 'freeze' the
|
||||||
# CXX_STANDARD at 98 during computation.
|
# CXX_STANDARD at 98 during computation.
|
||||||
$<$<COMPILE_FEATURES:cxx_auto_type>:empty2>
|
$<$<COMPILE_FEATURES:cxx_auto_type>:empty2>
|
||||||
# This would add cxx_static_assert, but that would require CXX_STANDARD = 11,
|
# This would add cxx_std_11, but that would require CXX_STANDARD = 11,
|
||||||
# which is not allowed after freeze. Report an error.
|
# which is not allowed after freeze. Report an error.
|
||||||
empty3
|
empty3
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ add_library(empty1 empty.cpp)
|
|||||||
|
|
||||||
add_library(empty2 INTERFACE)
|
add_library(empty2 INTERFACE)
|
||||||
add_library(empty3 INTERFACE)
|
add_library(empty3 INTERFACE)
|
||||||
target_compile_features(empty3 INTERFACE cxx_static_assert)
|
target_compile_features(empty3 INTERFACE cxx_std_11)
|
||||||
|
|
||||||
target_link_libraries(empty1
|
target_link_libraries(empty1
|
||||||
$<$<COMPILE_FEATURES:cxx_nullptr>:empty2>
|
$<$<COMPILE_FEATURES:cxx_nullptr>:empty2>
|
||||||
|
|||||||
Reference in New Issue
Block a user