Commit 9fd602bf authored by Robert Maynard's avatar Robert Maynard Committed by Brad King

Genex: PlatformId now can match against a list of ids.

parent ec66af20
......@@ -110,9 +110,10 @@ Variable Queries
The mapping in :prop_tgt:`MAP_IMPORTED_CONFIG_<CONFIG>` is also considered by
this expression when it is evaluated on a property on an :prop_tgt:`IMPORTED`
target.
``$<PLATFORM_ID:platform_id>``
``1`` if the CMake's platform id matches ``platform_id``
otherwise ``0``.
``$<PLATFORM_ID:platform_ids>``
where ``platform_ids`` is a comma-separated list.
``1`` if the CMake's platform id matches any one of the entries in
``platform_ids``, otherwise ``0``.
See also the :variable:`CMAKE_SYSTEM_NAME` variable.
``$<C_COMPILER_ID:compiler_ids>``
where ``compiler_ids`` is a comma-separated list.
......
......@@ -776,7 +776,7 @@ struct PlatformIdNode : public cmGeneratorExpressionNode
{
PlatformIdNode() {} // NOLINT(modernize-use-equals-default)
int NumExpectedParameters() const override { return OneOrZeroParameters; }
int NumExpectedParameters() const override { return ZeroOrMoreParameters; }
std::string Evaluate(
const std::vector<std::string>& parameters,
......@@ -794,8 +794,10 @@ struct PlatformIdNode : public cmGeneratorExpressionNode
return parameters.front().empty() ? "1" : "0";
}
if (parameters.front() == platformId) {
return "1";
for (auto& param : parameters) {
if (param == platformId) {
return "1";
}
}
return "0";
}
......
......@@ -220,6 +220,7 @@ add_custom_target(check-part3 ALL
-Dtest_early_termination_2=$<$<1:>:,
-Dsystem_name=${CMAKE_HOST_SYSTEM_NAME}
-Dtest_platform_id=$<PLATFORM_ID>
-Dtest_platform_id_supported=$<PLATFORM_ID:Linux,Windows,Darwin>
-Dtest_platform_id_Linux=$<PLATFORM_ID:Linux>
-Dtest_platform_id_Windows=$<PLATFORM_ID:Windows>
-Dtest_platform_id_Darwin=$<PLATFORM_ID:Darwin>
......
......@@ -28,11 +28,16 @@ check(test_early_termination_2 "$<:,")
check(test_platform_id "${system_name}")
foreach(system Linux Windows Darwin)
if(system_name STREQUAL system)
check(test_platform_id_supported 1)
check(test_platform_id_${system} 1)
set(platform_supported 1)
else()
check(test_platform_id_${system} 0)
endif()
endforeach()
if(NOT platform_supported)
check(test_platform_id_supported 0)
endif()
check(lower_case "mi,xed")
check(upper_case "MIX,ED")
check(make_c_identifier "_4f_oo__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