diff options
author | Kyle Edwards <kyle.edwards@kitware.com> | 2022-05-25 18:33:38 (GMT) |
---|---|---|
committer | Kyle Edwards <kyle.edwards@kitware.com> | 2022-05-25 18:37:27 (GMT) |
commit | aadaac7f6dff05c90b61079d70e304d157ea9bab (patch) | |
tree | 620bdfa228029ece66b674bf9d06272e0ca867d1 /Tests/RunCMake/VerifyHeaderSets | |
parent | 5dcf505f63037e23094146730704b031c57c5d06 (diff) | |
download | CMake-aadaac7f6dff05c90b61079d70e304d157ea9bab.zip CMake-aadaac7f6dff05c90b61079d70e304d157ea9bab.tar.gz CMake-aadaac7f6dff05c90b61079d70e304d157ea9bab.tar.bz2 |
VERIFY_INTERFACE_HEADER_SETS: Add property for list of header sets
Add a new property, INTERFACE_HEADER_SETS_TO_VERIFY, which contains
a list of header sets that should be verified by
VERIFY_INTERFACE_HEADER_SETS.
Fixes: #23522
Diffstat (limited to 'Tests/RunCMake/VerifyHeaderSets')
6 files changed, 33 insertions, 0 deletions
diff --git a/Tests/RunCMake/VerifyHeaderSets/RunCMakeTest.cmake b/Tests/RunCMake/VerifyHeaderSets/RunCMakeTest.cmake index edc655b..f022a43 100644 --- a/Tests/RunCMake/VerifyHeaderSets/RunCMakeTest.cmake +++ b/Tests/RunCMake/VerifyHeaderSets/RunCMakeTest.cmake @@ -40,3 +40,8 @@ endif() run_cmake_build(VerifyHeaderSets lang_test_c_verify_interface_header_sets) run_cmake_build(VerifyHeaderSets lang_test_cxx_verify_interface_header_sets) +run_cmake_build(VerifyHeaderSets list_verify_interface_header_sets) + +set(RunCMake_TEST_OPTIONS -DCMAKE_VERIFY_INTERFACE_HEADER_SETS=ON) +run_cmake(VerifyHeaderSetsNonexistent) +unset(RunCMake_TEST_OPTIONS) diff --git a/Tests/RunCMake/VerifyHeaderSets/VerifyHeaderSets.cmake b/Tests/RunCMake/VerifyHeaderSets/VerifyHeaderSets.cmake index 24298df..82ed935 100644 --- a/Tests/RunCMake/VerifyHeaderSets/VerifyHeaderSets.cmake +++ b/Tests/RunCMake/VerifyHeaderSets/VerifyHeaderSets.cmake @@ -58,3 +58,13 @@ target_sources(lang_test_c INTERFACE FILE_SET HEADERS FILES lang_test.h) add_library(lang_test_cxx STATIC lib.c lib.cxx) target_compile_definitions(lang_test_cxx INTERFACE EXPECT_CXX) target_sources(lang_test_cxx INTERFACE FILE_SET HEADERS FILES lang_test.h) + +set_property(SOURCE error.h PROPERTY LANGUAGE C) + +add_library(list STATIC lib.c) +target_sources(list INTERFACE + FILE_SET a TYPE HEADERS FILES a.h + FILE_SET c TYPE HEADERS FILES dir/c.h + FILE_SET error TYPE HEADERS FILES error.h + ) +set_property(TARGET list PROPERTY INTERFACE_HEADER_SETS_TO_VERIFY "a;c") diff --git a/Tests/RunCMake/VerifyHeaderSets/VerifyHeaderSetsNonexistent-result.txt b/Tests/RunCMake/VerifyHeaderSets/VerifyHeaderSetsNonexistent-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/VerifyHeaderSets/VerifyHeaderSetsNonexistent-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/VerifyHeaderSets/VerifyHeaderSetsNonexistent-stderr.txt b/Tests/RunCMake/VerifyHeaderSets/VerifyHeaderSetsNonexistent-stderr.txt new file mode 100644 index 0000000..76c2f94 --- /dev/null +++ b/Tests/RunCMake/VerifyHeaderSets/VerifyHeaderSetsNonexistent-stderr.txt @@ -0,0 +1,9 @@ +^CMake Error in CMakeLists\.txt: + Property INTERFACE_HEADER_SETS_TO_VERIFY of target "nonexistent" contained + the following header sets that are nonexistent or not INTERFACE: + + b + c + + +CMake Generate step failed\. Build files cannot be regenerated correctly\.$ diff --git a/Tests/RunCMake/VerifyHeaderSets/VerifyHeaderSetsNonexistent.cmake b/Tests/RunCMake/VerifyHeaderSets/VerifyHeaderSetsNonexistent.cmake new file mode 100644 index 0000000..b269b73 --- /dev/null +++ b/Tests/RunCMake/VerifyHeaderSets/VerifyHeaderSetsNonexistent.cmake @@ -0,0 +1,5 @@ +enable_language(C) + +add_library(nonexistent STATIC lib.c) +target_sources(nonexistent INTERFACE FILE_SET a TYPE HEADERS FILES a.h) +set_property(TARGET nonexistent PROPERTY INTERFACE_HEADER_SETS_TO_VERIFY "a;c;b") diff --git a/Tests/RunCMake/VerifyHeaderSets/error.h b/Tests/RunCMake/VerifyHeaderSets/error.h new file mode 100644 index 0000000..cbba5ae --- /dev/null +++ b/Tests/RunCMake/VerifyHeaderSets/error.h @@ -0,0 +1,3 @@ +#error "This file should not be included" + +extern void error_h(void); |