mirror of
https://github.com/Kitware/CMake.git
synced 2026-01-11 08:20:18 -06:00
Help: Document TARGET_PROPERTY genex behavior on unset property
Also add an explicit test for the case. Fixes: #25968
This commit is contained in:
@@ -1751,7 +1751,8 @@ These expressions look up the values of
|
||||
|
||||
.. genex:: $<TARGET_PROPERTY:tgt,prop>
|
||||
|
||||
Value of the property ``prop`` on the target ``tgt``.
|
||||
Value of the property ``prop`` on the target ``tgt``, or empty if
|
||||
the property is not set.
|
||||
|
||||
Note that ``tgt`` is not added as a dependency of the target this
|
||||
expression is evaluated on.
|
||||
@@ -1767,9 +1768,10 @@ These expressions look up the values of
|
||||
:target: TARGET_PROPERTY:prop
|
||||
|
||||
Value of the property ``prop`` on the target for which the expression
|
||||
is being evaluated. Note that for generator expressions in
|
||||
:ref:`Target Usage Requirements` this is the consuming target rather
|
||||
than the target specifying the requirement.
|
||||
is being evaluated, or empty if the property is not set.
|
||||
Note that for generator expressions in :ref:`Target Usage Requirements`
|
||||
this is the consuming target rather than the target specifying the
|
||||
requirement.
|
||||
|
||||
The expressions have special evaluation rules for some properties:
|
||||
|
||||
|
||||
@@ -16,6 +16,7 @@ run_cmake(SOURCES)
|
||||
run_cmake(TransitiveBuild)
|
||||
run_cmake(TransitiveLink-CMP0166-OLD)
|
||||
run_cmake(TransitiveLink-CMP0166-NEW)
|
||||
run_cmake(Unset)
|
||||
|
||||
block()
|
||||
run_cmake(Scope)
|
||||
|
||||
4
Tests/RunCMake/GenEx-TARGET_PROPERTY/Unset-check.cmake
Normal file
4
Tests/RunCMake/GenEx-TARGET_PROPERTY/Unset-check.cmake
Normal file
@@ -0,0 +1,4 @@
|
||||
file(READ ${RunCMake_TEST_BINARY_DIR}/out.txt out)
|
||||
if(NOT out STREQUAL "'' ''")
|
||||
set(RunCMake_TEST_FAILED "PROPERTY_THAT_IS_NOT_SET did not evaluate as empty:\n ${out}")
|
||||
endif()
|
||||
3
Tests/RunCMake/GenEx-TARGET_PROPERTY/Unset.cmake
Normal file
3
Tests/RunCMake/GenEx-TARGET_PROPERTY/Unset.cmake
Normal file
@@ -0,0 +1,3 @@
|
||||
add_library(iface INTERFACE)
|
||||
file(GENERATE OUTPUT out.txt CONTENT
|
||||
"'$<TARGET_PROPERTY:iface,PROPERTY_THAT_IS_NOT_SET>' '$<TARGET_PROPERTY:PROPERTY_THAT_IS_NOT_SET>'" TARGET iface)
|
||||
Reference in New Issue
Block a user