Commit 1242f4e5 authored by Stephen Kelly's avatar Stephen Kelly
Browse files

Genex: Add {UPPER,LOWER}_CASE and MAKE_C_IDENTIFIER.

parent 754b3212
......@@ -178,3 +178,9 @@ property is non-empty::
Content of ``...`` when the property is exported using :command:`export`, or
when the target is used by another target in the same buildsystem. Expands to
the empty string otherwise.
``$<LOWER_CASE:...>``
Content of ``...`` converted to lower case.
``$<UPPER_CASE:...>``
Content of ``...`` converted to upper case.
``$<MAKE_C_IDENTIFIER:...>``
Content of ``...`` converted to a C identifier.
......@@ -198,6 +198,48 @@ static const struct StrEqualNode : public cmGeneratorExpressionNode
}
} strEqualNode;
//----------------------------------------------------------------------------
static const struct LowerCaseNode : public cmGeneratorExpressionNode
{
LowerCaseNode() {}
std::string Evaluate(const std::vector<std::string> &parameters,
cmGeneratorExpressionContext *,
const GeneratorExpressionContent *,
cmGeneratorExpressionDAGChecker *) const
{
return cmSystemTools::LowerCase(parameters.front());
}
} lowerCaseNode;
//----------------------------------------------------------------------------
static const struct UpperCaseNode : public cmGeneratorExpressionNode
{
UpperCaseNode() {}
std::string Evaluate(const std::vector<std::string> &parameters,
cmGeneratorExpressionContext *,
const GeneratorExpressionContent *,
cmGeneratorExpressionDAGChecker *) const
{
return cmSystemTools::UpperCase(parameters.front());
}
} upperCaseNode;
//----------------------------------------------------------------------------
static const struct MakeCIdentifierNode : public cmGeneratorExpressionNode
{
MakeCIdentifierNode() {}
std::string Evaluate(const std::vector<std::string> &parameters,
cmGeneratorExpressionContext *,
const GeneratorExpressionContent *,
cmGeneratorExpressionDAGChecker *) const
{
return cmSystemTools::MakeCidentifier(parameters.front().c_str());
}
} makeCIdentifierNode;
//----------------------------------------------------------------------------
static const struct Angle_RNode : public cmGeneratorExpressionNode
{
......@@ -1442,6 +1484,12 @@ cmGeneratorExpressionNode* GetNode(const std::string &identifier)
return &targetSoNameFileDirNode;
else if (identifier == "STREQUAL")
return &strEqualNode;
else if (identifier == "LOWER_CASE")
return &lowerCaseNode;
else if (identifier == "UPPER_CASE")
return &upperCaseNode;
else if (identifier == "MAKE_C_IDENTIFIER")
return &makeCIdentifierNode;
else if (identifier == "BOOL")
return &boolNode;
else if (identifier == "ANGLE-R")
......
......@@ -193,6 +193,9 @@ add_custom_target(check-part3 ALL
-Dtest_platform_id_Linux=$<PLATFORM_ID:Linux>
-Dtest_platform_id_Windows=$<PLATFORM_ID:Windows>
-Dtest_platform_id_Darwin=$<PLATFORM_ID:Darwin>
-Dlower_case=$<LOWER_CASE:MiXeD>
-Dupper_case=$<UPPER_CASE:MiXeD>
-Dmake_c_identifier=$<MAKE_C_IDENTIFIER:4foo:+bar-$>
-P ${CMAKE_CURRENT_SOURCE_DIR}/check-part3.cmake
COMMAND ${CMAKE_COMMAND} -E echo "check done (part 3 of 3)"
VERBATIM
......
......@@ -34,3 +34,6 @@ foreach(system Linux Windows Darwin)
check(test_platform_id_${system} 0)
endif()
endforeach()
check(lower_case "mixed")
check(upper_case "MIXED")
check(make_c_identifier "_4foo__bar__")
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment