From 87c3b5e421b3f39d52caa113da4b577c6b68fa03 Mon Sep 17 00:00:00 2001 From: Craig Scott Date: Sat, 19 Mar 2022 17:03:26 +1100 Subject: define_property(): Only test prefix if INITIALIZE_FROM_VARIABLE is given --- Source/cmDefinePropertyCommand.cxx | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/Source/cmDefinePropertyCommand.cxx b/Source/cmDefinePropertyCommand.cxx index 7a2f34f..15b2652 100644 --- a/Source/cmDefinePropertyCommand.cxx +++ b/Source/cmDefinePropertyCommand.cxx @@ -97,20 +97,20 @@ bool cmDefinePropertyCommand(std::vector const& args, PropertyName, "\"")); return false; } - } - // Make sure the variable is not reserved. - static constexpr const char* reservedPrefixes[] = { - "CMAKE_", - "_CMAKE_", - }; - if (std::any_of(std::begin(reservedPrefixes), std::end(reservedPrefixes), - [&initializeFromVariable](const char* prefix) { - return cmHasPrefix(initializeFromVariable, prefix); - })) { - status.SetError( - cmStrCat("variable name \"", initializeFromVariable, "\" is reserved")); - return false; + // Make sure the variable is not reserved. + static constexpr const char* reservedPrefixes[] = { + "CMAKE_", + "_CMAKE_", + }; + if (std::any_of(std::begin(reservedPrefixes), std::end(reservedPrefixes), + [&initializeFromVariable](const char* prefix) { + return cmHasPrefix(initializeFromVariable, prefix); + })) { + status.SetError(cmStrCat("variable name \"", initializeFromVariable, + "\" is reserved")); + return false; + } } // Actually define the property. -- cgit v0.12