mirror of
https://github.com/Kitware/CMake.git
synced 2026-03-17 09:11:36 -05:00
GeneratorExpression: Add $<QUOTE> generator expression
Support inserting '"' literals in generator expressions Fixes #20869
This commit is contained in:
@@ -2410,6 +2410,13 @@ special meaning.
|
||||
|
||||
A literal ``;``. Used to prevent list expansion on an argument with ``;``.
|
||||
|
||||
.. genex:: $<QUOTE>
|
||||
|
||||
.. versionadded:: 3.30
|
||||
|
||||
A literal ``"``. Used to allow string literal quotes inside a generator expression.
|
||||
|
||||
|
||||
Deprecated Expressions
|
||||
----------------------
|
||||
|
||||
|
||||
4
Help/release/dev/genex-quote.rst
Normal file
4
Help/release/dev/genex-quote.rst
Normal file
@@ -0,0 +1,4 @@
|
||||
genex-quote
|
||||
-----------
|
||||
|
||||
* The :genex:`$<QUOTE>` generator expression was added to evaluate to ``"``.
|
||||
@@ -1859,6 +1859,7 @@ struct CharacterNode : public cmGeneratorExpressionNode
|
||||
static const CharacterNode<'>'> angle_rNode;
|
||||
static const CharacterNode<','> commaNode;
|
||||
static const CharacterNode<';'> semicolonNode;
|
||||
static const CharacterNode<'"'> quoteNode;
|
||||
|
||||
struct CompilerIdNode : public cmGeneratorExpressionNode
|
||||
{
|
||||
@@ -4529,6 +4530,7 @@ const cmGeneratorExpressionNode* cmGeneratorExpressionNode::GetNode(
|
||||
{ "ANGLE-R", &angle_rNode },
|
||||
{ "COMMA", &commaNode },
|
||||
{ "SEMICOLON", &semicolonNode },
|
||||
{ "QUOTE", "eNode },
|
||||
{ "TARGET_PROPERTY", &targetPropertyNode },
|
||||
{ "TARGET_NAME", &targetNameNode },
|
||||
{ "TARGET_OBJECTS", &targetObjectsNode },
|
||||
|
||||
@@ -70,6 +70,7 @@ add_custom_target(check-part1 ALL
|
||||
-Dtest_strequal_comma=$<STREQUAL:$<COMMA>,$<COMMA>>
|
||||
-Dtest_strequal_semicolon=$<STREQUAL:$<SEMICOLON>,$<SEMICOLON>>
|
||||
-Dtest_strequal_angle_r_comma=$<STREQUAL:$<ANGLE-R>,$<COMMA>>
|
||||
-Dtest_strequal_quote=$<STREQUAL:$<QUOTE>,$<QUOTE>>
|
||||
-Dtest_strequal_both_empty=$<STREQUAL:,>
|
||||
-Dtest_strequal_one_empty=$<STREQUAL:something,>
|
||||
-Dtest_inlist_true=$<IN_LIST:a,a$<SEMICOLON>b>
|
||||
|
||||
@@ -47,6 +47,7 @@ check(test_strequal_angle_r "1")
|
||||
check(test_strequal_comma "1")
|
||||
check(test_strequal_semicolon "1")
|
||||
check(test_strequal_angle_r_comma "0")
|
||||
check(test_strequal_quote "1")
|
||||
check(test_strequal_both_empty "1")
|
||||
check(test_strequal_one_empty "0")
|
||||
check(test_inlist_true "1")
|
||||
|
||||
@@ -1 +1 @@
|
||||
lorem ipsum, 01
|
||||
"lorem ipsum, 01"
|
||||
|
||||
@@ -3,7 +3,7 @@ set_property(TARGET helper PROPERTY MY_TEXT "lorem ipsum")
|
||||
add_custom_command(
|
||||
OUTPUT out.txt
|
||||
COMMAND ${CMAKE_COMMAND} -E echo true
|
||||
COMMENT "$<TARGET_PROPERTY:helper,MY_TEXT>$<COMMA> $<STREQUAL:foo,bar>$<EQUAL:42,42>"
|
||||
COMMENT "$<QUOTE>$<TARGET_PROPERTY:helper,MY_TEXT>$<COMMA> $<STREQUAL:foo,bar>$<EQUAL:42,42>$<QUOTE>"
|
||||
)
|
||||
set_property(SOURCE out.txt PROPERTY SYMBOLIC 1)
|
||||
add_custom_target(main ALL DEPENDS out.txt)
|
||||
|
||||
Reference in New Issue
Block a user