diff --git a/Source/cmDocumentGeneratorExpressions.h b/Source/cmDocumentGeneratorExpressions.h index 76a60c3b6..6cc3f25ae 100644 --- a/Source/cmDocumentGeneratorExpressions.h +++ b/Source/cmDocumentGeneratorExpressions.h @@ -26,6 +26,8 @@ "strings which contain a '>' for example.\n" \ " $ = A literal ','. Used to compare " \ "strings which contain a ',' for example.\n" \ + " $ = A literal ';'. Used to prevent " \ + "list expansion on an argument with ';'.\n" \ " $ = Marks ... as being the name of a " \ "target. This is required if exporting targets to multiple " \ "dependent export sets. The '...' must be a literal name of a " \ diff --git a/Source/cmGeneratorExpressionEvaluator.cxx b/Source/cmGeneratorExpressionEvaluator.cxx index e2d877756..6618e83e2 100644 --- a/Source/cmGeneratorExpressionEvaluator.cxx +++ b/Source/cmGeneratorExpressionEvaluator.cxx @@ -226,6 +226,22 @@ static const struct CommaNode : public cmGeneratorExpressionNode } } commaNode; +//---------------------------------------------------------------------------- +static const struct SemicolonNode : public cmGeneratorExpressionNode +{ + SemicolonNode() {} + + virtual int NumExpectedParameters() const { return 0; } + + std::string Evaluate(const std::vector &, + cmGeneratorExpressionContext *, + const GeneratorExpressionContent *, + cmGeneratorExpressionDAGChecker *) const + { + return ";"; + } +} semicolonNode; + //---------------------------------------------------------------------------- static const struct ConfigurationNode : public cmGeneratorExpressionNode { @@ -943,6 +959,8 @@ cmGeneratorExpressionNode* GetNode(const std::string &identifier) return &angle_rNode; else if (identifier == "COMMA") return &commaNode; + else if (identifier == "SEMICOLON") + return &semicolonNode; else if (identifier == "TARGET_PROPERTY") return &targetPropertyNode; else if (identifier == "TARGET_NAME") diff --git a/Tests/GeneratorExpression/CMakeLists.txt b/Tests/GeneratorExpression/CMakeLists.txt index fff7c8720..0008c1656 100644 --- a/Tests/GeneratorExpression/CMakeLists.txt +++ b/Tests/GeneratorExpression/CMakeLists.txt @@ -47,11 +47,13 @@ add_custom_target(check-part1 ALL -Dtest_strequal_no_yes=$ -Dtest_strequal_angle_r=$,$> -Dtest_strequal_comma=$,$> + -Dtest_strequal_semicolon=$,$> -Dtest_strequal_angle_r_comma=$,$> -Dtest_strequal_both_empty=$ -Dtest_strequal_one_empty=$ -Dtest_angle_r=$ -Dtest_comma=$ + -Dtest_semicolon=$ -Dtest_colons_1=$<1::> -Dtest_colons_2=$<1:::> -Dtest_colons_3=$<1:Qt5::Core> diff --git a/Tests/GeneratorExpression/check-part1.cmake b/Tests/GeneratorExpression/check-part1.cmake index 7abfa823f..9bef15904 100644 --- a/Tests/GeneratorExpression/check-part1.cmake +++ b/Tests/GeneratorExpression/check-part1.cmake @@ -44,11 +44,13 @@ check(test_strequal_yes_no "0") check(test_strequal_no_yes "0") 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_both_empty "1") check(test_strequal_one_empty "0") check(test_angle_r ">") check(test_comma ",") +check(test_semicolon ";") check(test_colons_1 ":") check(test_colons_2 "::") check(test_colons_3 "Qt5::Core")