diff options
author | Kyle Edwards <kyle.edwards@kitware.com> | 2022-03-21 20:34:15 (GMT) |
---|---|---|
committer | Craig Scott <craig.scott@crascit.com> | 2022-03-23 05:39:32 (GMT) |
commit | 26caa97057445232ce50d4e1de1dff219ae5826b (patch) | |
tree | 2ae9c119648f9761aa383e6a6d4245760ec68b6c /Tests | |
parent | 2aad4cef979bd5174f067424a117fac765e3da34 (diff) | |
download | CMake-26caa97057445232ce50d4e1de1dff219ae5826b.zip CMake-26caa97057445232ce50d4e1de1dff219ae5826b.tar.gz CMake-26caa97057445232ce50d4e1de1dff219ae5826b.tar.bz2 |
define_property(): Change constraints of INITIALIZE_FROM_VARIABLE
Remove the requirement that the variable name have a prefix while
keeping the suffix requirement. Require that the property name
contains an underscore. Update docs and tests accordingly.
Fixes: #23340
Diffstat (limited to 'Tests')
11 files changed, 23 insertions, 23 deletions
diff --git a/Tests/RunCMake/define_property/RunCMakeTest.cmake b/Tests/RunCMake/define_property/RunCMakeTest.cmake index 7d7c75b..93eaf1b 100644 --- a/Tests/RunCMake/define_property/RunCMakeTest.cmake +++ b/Tests/RunCMake/define_property/RunCMakeTest.cmake @@ -6,4 +6,4 @@ run_cmake(define_property-INITIALIZE_FROM_VARIABLE-invalid_1) run_cmake(define_property-INITIALIZE_FROM_VARIABLE-invalid_2) run_cmake(define_property-INITIALIZE_FROM_VARIABLE-non_target) run_cmake(define_property-INITIALIZE_FROM_VARIABLE-wrong_suffix) -run_cmake(define_property-INITIALIZE_FROM_VARIABLE-no_prefix) +run_cmake(define_property-INITIALIZE_FROM_VARIABLE-no_underscore) diff --git a/Tests/RunCMake/define_property/define_property-INITIALIZE_FROM_VARIABLE-invalid_1-stderr.txt b/Tests/RunCMake/define_property/define_property-INITIALIZE_FROM_VARIABLE-invalid_1-stderr.txt index a7903c9..c5ae467 100644 --- a/Tests/RunCMake/define_property/define_property-INITIALIZE_FROM_VARIABLE-invalid_1-stderr.txt +++ b/Tests/RunCMake/define_property/define_property-INITIALIZE_FROM_VARIABLE-invalid_1-stderr.txt @@ -1,4 +1,4 @@ ^CMake Error at define_property-INITIALIZE_FROM_VARIABLE-invalid_1\.cmake:[0-9]+ \(define_property\): - define_property variable name "CMAKE_PROP1" is reserved + define_property variable name "CMAKE_Test_PROP1" is reserved Call Stack \(most recent call first\): CMakeLists\.txt:[0-9]+ \(include\)$ diff --git a/Tests/RunCMake/define_property/define_property-INITIALIZE_FROM_VARIABLE-invalid_1.cmake b/Tests/RunCMake/define_property/define_property-INITIALIZE_FROM_VARIABLE-invalid_1.cmake index 873263a..edb8852 100644 --- a/Tests/RunCMake/define_property/define_property-INITIALIZE_FROM_VARIABLE-invalid_1.cmake +++ b/Tests/RunCMake/define_property/define_property-INITIALIZE_FROM_VARIABLE-invalid_1.cmake @@ -1,3 +1,3 @@ -define_property(TARGET PROPERTY PROP1 - INITIALIZE_FROM_VARIABLE CMAKE_PROP1 +define_property(TARGET PROPERTY Test_PROP1 + INITIALIZE_FROM_VARIABLE CMAKE_Test_PROP1 ) diff --git a/Tests/RunCMake/define_property/define_property-INITIALIZE_FROM_VARIABLE-invalid_2-stderr.txt b/Tests/RunCMake/define_property/define_property-INITIALIZE_FROM_VARIABLE-invalid_2-stderr.txt index ea6bc86..3dbee34 100644 --- a/Tests/RunCMake/define_property/define_property-INITIALIZE_FROM_VARIABLE-invalid_2-stderr.txt +++ b/Tests/RunCMake/define_property/define_property-INITIALIZE_FROM_VARIABLE-invalid_2-stderr.txt @@ -1,4 +1,4 @@ ^CMake Error at define_property-INITIALIZE_FROM_VARIABLE-invalid_2\.cmake:[0-9]+ \(define_property\): - define_property variable name "_CMAKE_PROP1" is reserved + define_property variable name "_CMAKE_Test_PROP1" is reserved Call Stack \(most recent call first\): CMakeLists\.txt:[0-9]+ \(include\)$ diff --git a/Tests/RunCMake/define_property/define_property-INITIALIZE_FROM_VARIABLE-invalid_2.cmake b/Tests/RunCMake/define_property/define_property-INITIALIZE_FROM_VARIABLE-invalid_2.cmake index 95945a3..e1c3ca5 100644 --- a/Tests/RunCMake/define_property/define_property-INITIALIZE_FROM_VARIABLE-invalid_2.cmake +++ b/Tests/RunCMake/define_property/define_property-INITIALIZE_FROM_VARIABLE-invalid_2.cmake @@ -1,3 +1,3 @@ -define_property(TARGET PROPERTY PROP1 - INITIALIZE_FROM_VARIABLE _CMAKE_PROP1 +define_property(TARGET PROPERTY Test_PROP1 + INITIALIZE_FROM_VARIABLE _CMAKE_Test_PROP1 ) diff --git a/Tests/RunCMake/define_property/define_property-INITIALIZE_FROM_VARIABLE-no_prefix-stderr.txt b/Tests/RunCMake/define_property/define_property-INITIALIZE_FROM_VARIABLE-no_prefix-stderr.txt deleted file mode 100644 index fc9099c..0000000 --- a/Tests/RunCMake/define_property/define_property-INITIALIZE_FROM_VARIABLE-no_prefix-stderr.txt +++ /dev/null @@ -1,5 +0,0 @@ -^CMake Error at define_property-INITIALIZE_FROM_VARIABLE-no_prefix\.cmake:[0-9]+ \(define_property\): - define_property Variable name must have a non-empty prefix before property - name "PROP1" -Call Stack \(most recent call first\): - CMakeLists\.txt:[0-9]+ \(include\)$ diff --git a/Tests/RunCMake/define_property/define_property-INITIALIZE_FROM_VARIABLE-no_prefix-result.txt b/Tests/RunCMake/define_property/define_property-INITIALIZE_FROM_VARIABLE-no_underscore-result.txt index d00491f..d00491f 100644 --- a/Tests/RunCMake/define_property/define_property-INITIALIZE_FROM_VARIABLE-no_prefix-result.txt +++ b/Tests/RunCMake/define_property/define_property-INITIALIZE_FROM_VARIABLE-no_underscore-result.txt diff --git a/Tests/RunCMake/define_property/define_property-INITIALIZE_FROM_VARIABLE-no_underscore-stderr.txt b/Tests/RunCMake/define_property/define_property-INITIALIZE_FROM_VARIABLE-no_underscore-stderr.txt new file mode 100644 index 0000000..9bbdd8b --- /dev/null +++ b/Tests/RunCMake/define_property/define_property-INITIALIZE_FROM_VARIABLE-no_underscore-stderr.txt @@ -0,0 +1,5 @@ +^CMake Error at define_property-INITIALIZE_FROM_VARIABLE-no_underscore\.cmake:[0-9]+ \(define_property\): + define_property Property name "PROP1" defined with INITIALIZE_FROM_VARIABLE + does not contain underscore +Call Stack \(most recent call first\): + CMakeLists\.txt:[0-9]+ \(include\)$ diff --git a/Tests/RunCMake/define_property/define_property-INITIALIZE_FROM_VARIABLE-no_prefix.cmake b/Tests/RunCMake/define_property/define_property-INITIALIZE_FROM_VARIABLE-no_underscore.cmake index cc39b57..cc39b57 100644 --- a/Tests/RunCMake/define_property/define_property-INITIALIZE_FROM_VARIABLE-no_prefix.cmake +++ b/Tests/RunCMake/define_property/define_property-INITIALIZE_FROM_VARIABLE-no_underscore.cmake diff --git a/Tests/RunCMake/define_property/define_property-INITIALIZE_FROM_VARIABLE-subdirectory/CMakeLists.txt b/Tests/RunCMake/define_property/define_property-INITIALIZE_FROM_VARIABLE-subdirectory/CMakeLists.txt index 67c186d..ee128ec 100644 --- a/Tests/RunCMake/define_property/define_property-INITIALIZE_FROM_VARIABLE-subdirectory/CMakeLists.txt +++ b/Tests/RunCMake/define_property/define_property-INITIALIZE_FROM_VARIABLE-subdirectory/CMakeLists.txt @@ -1,11 +1,11 @@ -define_property(TARGET PROPERTY PROP2 +define_property(TARGET PROPERTY Test_PROP2 INITIALIZE_FROM_VARIABLE Test_PROP2 ) -define_property(TARGET PROPERTY PROP3 - INITIALIZE_FROM_VARIABLE Test_PROP3 +define_property(TARGET PROPERTY Test_PROP3 + INITIALIZE_FROM_VARIABLE MyTest_PROP3 ) add_executable(sub_exe ../main.c) -assert_prop_eq(sub_exe PROP1 "Hello") -assert_prop_eq(sub_exe PROP2 "world") -assert_prop_eq(sub_exe PROP3 "!") +assert_prop_eq(sub_exe Test_PROP1 "Hello") +assert_prop_eq(sub_exe Test_PROP2 "world") +assert_prop_eq(sub_exe Test_PROP3 "!") diff --git a/Tests/RunCMake/define_property/define_property-INITIALIZE_FROM_VARIABLE.cmake b/Tests/RunCMake/define_property/define_property-INITIALIZE_FROM_VARIABLE.cmake index d866fc9..5014c74 100644 --- a/Tests/RunCMake/define_property/define_property-INITIALIZE_FROM_VARIABLE.cmake +++ b/Tests/RunCMake/define_property/define_property-INITIALIZE_FROM_VARIABLE.cmake @@ -16,14 +16,14 @@ endfunction() set(Test_PROP1 "Hello") set(Test_PROP2 "world") -set(Test_PROP3 "!") -define_property(TARGET PROPERTY PROP1 +set(MyTest_PROP3 "!") +define_property(TARGET PROPERTY Test_PROP1 INITIALIZE_FROM_VARIABLE Test_PROP1 ) add_subdirectory(define_property-INITIALIZE_FROM_VARIABLE-subdirectory) add_executable(top_exe main.c) -assert_prop_eq(top_exe PROP1 "Hello") -assert_prop_eq(top_exe PROP2 "world") -assert_prop_eq(top_exe PROP3 "!") +assert_prop_eq(top_exe Test_PROP1 "Hello") +assert_prop_eq(top_exe Test_PROP2 "world") +assert_prop_eq(top_exe Test_PROP3 "!") |