This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMake".
The branch, master has been updated via ce79364581643700ab88ee4c442e0cf1736c926e (commit) via eef1dacf51ea32b98596608e6d4dab0f18b1457b (commit) via e08efc36eb17992f4bb8697b4173ede913aafab4 (commit) via 4783b842baf0e081b3385b00d696b6635eee655d (commit) via 5f5e3062cf2394f4e28e078817e074892e9c508d (commit) via 94c5fa5f7a189c1a99891bbacc6a3b291f399d7a (commit) via 101135069425a1f3af85aa7d1fedf2656d9674f0 (commit) via d9beea0ccacc8c3cdc14b71b660a73a458f09650 (commit) via 3d856eba16fae90f66dd142f91c21d4121b760d0 (commit) via 9e1df5df5479b78d65d37e58b5cd0c93d70838ae (commit) via 36f36d6a49976527a13a77d1ffff1fcdc5c3f5ba (commit) via 3f57787dffa629b7c10ca2a02229b7e1a4bfe1f9 (commit) via 20d7c5631e88d80cb683a5e120c0c1e1f077945a (commit) via abd62201bd7d10f8eb27229ac3f5e55d52d0659e (commit) via f2c8ff825995c1425a134e24eee6c4fb73c3a6b2 (commit) from 3b4315dc23bdedb3163a0c84b9fdbae2324470c6 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=ce79364581643700ab88ee4c442e0cf1736c926e commit ce79364581643700ab88ee4c442e0cf1736c926e Merge: eef1dac 4783b84 Author: Brad King <brad.k...@kitware.com> AuthorDate: Thu May 2 13:46:32 2019 +0000 Commit: Kitware Robot <kwro...@kitware.com> CommitDate: Thu May 2 09:46:39 2019 -0400 Merge topic 'ios_fixes' 4783b842ba iOS: Only set the CMAKE_FIND_ROOT_PATH_MODE_* variables when not defined 5f5e3062cf iOS: Only look for packages in the provided CMAKE_FIND_ROOT_PATHs 94c5fa5f7a iOS: Allow setting multiple CMAKE_FIND_ROOT_PATH values 1011350694 iOS: Allow specifying CMAKE_MACOSX_BUNDLE in toolchain file Acked-by: Kitware Robot <kwro...@kitware.com> Merge-request: !3273 https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=eef1dacf51ea32b98596608e6d4dab0f18b1457b commit eef1dacf51ea32b98596608e6d4dab0f18b1457b Merge: e08efc3 d9beea0 Author: Brad King <brad.k...@kitware.com> AuthorDate: Thu May 2 13:43:52 2019 +0000 Commit: Kitware Robot <kwro...@kitware.com> CommitDate: Thu May 2 09:44:13 2019 -0400 Merge topic 'cpackrpm.debug' d9beea0cca CPackRPM: Hide CPACK_RPM_ROOTDIR debug if not CPACK_RPM_PACKAGE_DEBUG Acked-by: Kitware Robot <kwro...@kitware.com> Merge-request: !3271 https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=e08efc36eb17992f4bb8697b4173ede913aafab4 commit e08efc36eb17992f4bb8697b4173ede913aafab4 Merge: 3b4315d 3d856eb Author: Brad King <brad.k...@kitware.com> AuthorDate: Thu May 2 13:42:59 2019 +0000 Commit: Kitware Robot <kwro...@kitware.com> CommitDate: Thu May 2 09:43:09 2019 -0400 Merge topic 'genex-code-cleanup' 3d856eba16 cmGeneratorExpressionNode: refactor TargetPropertyNode 9e1df5df54 cmGeneratorExpressionNode: use ctor arguments instead of macro 36f36d6a49 cmGeneratorExpressionNode: add VersionNode 3f57787dff cmGeneratorExpressionNode: remove structs CompilerId*, CompilerVersion* 20d7c5631e cmGeneratorExpressionNode: add CharacterNode abd62201bd cmGeneratorExpressionNode: simplify code in EqualNode f2c8ff8259 cmGeneratorExpressionNode: Simplify static string constant Acked-by: Kitware Robot <kwro...@kitware.com> Merge-request: !3234 https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=4783b842baf0e081b3385b00d696b6635eee655d commit 4783b842baf0e081b3385b00d696b6635eee655d Author: Alexandru Croitor <alexandru.croi...@qt.io> AuthorDate: Tue Apr 30 19:10:08 2019 +0200 Commit: Alexandru Croitor <alexandru.croi...@qt.io> CommitDate: Tue Apr 30 19:10:08 2019 +0200 iOS: Only set the CMAKE_FIND_ROOT_PATH_MODE_* variables when not defined This allows overriding them in a toolchain file. diff --git a/Modules/Platform/Darwin.cmake b/Modules/Platform/Darwin.cmake index 27e5e81..7e02814 100644 --- a/Modules/Platform/Darwin.cmake +++ b/Modules/Platform/Darwin.cmake @@ -6,9 +6,15 @@ if(CMAKE_SYSTEM_NAME STREQUAL "iOS" OR CMAKE_SYSTEM_NAME STREQUAL "tvOS" OR CMAK endif() list(APPEND CMAKE_FIND_ROOT_PATH "${_CMAKE_OSX_SYSROOT_PATH}") - set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY) - set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY) - set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY) + if(NOT DEFINED CMAKE_FIND_ROOT_PATH_MODE_LIBRARY) + set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY) + endif() + if(NOT DEFINED CMAKE_FIND_ROOT_PATH_MODE_INCLUDE) + set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY) + endif() + if(NOT DEFINED CMAKE_FIND_ROOT_PATH_MODE_PACKAGE) + set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY) + endif() endif() # Darwin versions: https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=5f5e3062cf2394f4e28e078817e074892e9c508d commit 5f5e3062cf2394f4e28e078817e074892e9c508d Author: Alexandru Croitor <alexandru.croi...@qt.io> AuthorDate: Tue Apr 30 18:55:28 2019 +0200 Commit: Alexandru Croitor <alexandru.croi...@qt.io> CommitDate: Tue Apr 30 18:55:28 2019 +0200 iOS: Only look for packages in the provided CMAKE_FIND_ROOT_PATHs Both CMAKE_FIND_ROOT_PATH_MODE_INCLUDE and CMAKE_FIND_ROOT_PATH_MODE_LIBRARY are set to "ONLY" when cross building to iOS, but appears that CMAKE_FIND_ROOT_PATH_MODE_PACKAGE was overlooked. This causes packages to be searched for in the host system as well, which is incorrect and can lead to linking issues. Set CMAKE_FIND_ROOT_PATH_MODE_PACKAGE to "ONLY" as well. CMAKE_FIND_ROOT_PATH_MODE_PROGRAM is not touched, because a user might want to find programs / tools on the host system. diff --git a/Modules/Platform/Darwin.cmake b/Modules/Platform/Darwin.cmake index ab650ef..27e5e81 100644 --- a/Modules/Platform/Darwin.cmake +++ b/Modules/Platform/Darwin.cmake @@ -8,6 +8,7 @@ if(CMAKE_SYSTEM_NAME STREQUAL "iOS" OR CMAKE_SYSTEM_NAME STREQUAL "tvOS" OR CMAK list(APPEND CMAKE_FIND_ROOT_PATH "${_CMAKE_OSX_SYSROOT_PATH}") set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY) set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY) + set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY) endif() # Darwin versions: https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=94c5fa5f7a189c1a99891bbacc6a3b291f399d7a commit 94c5fa5f7a189c1a99891bbacc6a3b291f399d7a Author: Alexandru Croitor <alexandru.croi...@qt.io> AuthorDate: Tue Apr 30 13:34:47 2019 +0200 Commit: Alexandru Croitor <alexandru.croi...@qt.io> CommitDate: Tue Apr 30 13:40:31 2019 +0200 iOS: Allow setting multiple CMAKE_FIND_ROOT_PATH values Currently the value is hardcoded to contain only the sysroot for the respective darwin platform. This means that it can not be changed in a custom toolchain file. Instead of overriding the value, simply append it. This is similar to how it is done in the Google provided Android toolchain file. The usecase is to allow specifying addiitonal roots to look for 3rd party packages which are definitely not present in the default sysroot. diff --git a/Modules/Platform/Darwin.cmake b/Modules/Platform/Darwin.cmake index 9301ec9..ab650ef 100644 --- a/Modules/Platform/Darwin.cmake +++ b/Modules/Platform/Darwin.cmake @@ -5,7 +5,7 @@ if(CMAKE_SYSTEM_NAME STREQUAL "iOS" OR CMAKE_SYSTEM_NAME STREQUAL "tvOS" OR CMAK set(CMAKE_MACOSX_BUNDLE ON) endif() - set(CMAKE_FIND_ROOT_PATH "${_CMAKE_OSX_SYSROOT_PATH}") + list(APPEND CMAKE_FIND_ROOT_PATH "${_CMAKE_OSX_SYSROOT_PATH}") set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY) set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY) endif() https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=101135069425a1f3af85aa7d1fedf2656d9674f0 commit 101135069425a1f3af85aa7d1fedf2656d9674f0 Author: Alexandru Croitor <alexandru.croi...@qt.io> AuthorDate: Tue Apr 30 13:31:16 2019 +0200 Commit: Alexandru Croitor <alexandru.croi...@qt.io> CommitDate: Tue Apr 30 13:40:31 2019 +0200 iOS: Allow specifying CMAKE_MACOSX_BUNDLE in toolchain file Currently CMAKE_MACOSX_BUNDLE is always set to true when compiling for iOS. This poses a problem when using the source file variant of try_compile. Even if a custom value is passed via the CMAKE_FLAGS option, it would still be overridden by the Darwin.cmake file. Only set the value in case no other value was provided before. diff --git a/Modules/Platform/Darwin.cmake b/Modules/Platform/Darwin.cmake index 5590433..9301ec9 100644 --- a/Modules/Platform/Darwin.cmake +++ b/Modules/Platform/Darwin.cmake @@ -1,7 +1,9 @@ set(APPLE 1) if(CMAKE_SYSTEM_NAME STREQUAL "iOS" OR CMAKE_SYSTEM_NAME STREQUAL "tvOS" OR CMAKE_SYSTEM_NAME STREQUAL "watchOS") - set(CMAKE_MACOSX_BUNDLE ON) + if(NOT DEFINED CMAKE_MACOSX_BUNDLE) + set(CMAKE_MACOSX_BUNDLE ON) + endif() set(CMAKE_FIND_ROOT_PATH "${_CMAKE_OSX_SYSROOT_PATH}") set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY) https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=d9beea0ccacc8c3cdc14b71b660a73a458f09650 commit d9beea0ccacc8c3cdc14b71b660a73a458f09650 Author: Harry Mallon <hjmal...@gmail.com> AuthorDate: Tue Apr 30 10:46:57 2019 +0100 Commit: Harry Mallon <hjmal...@gmail.com> CommitDate: Tue Apr 30 10:52:53 2019 +0100 CPackRPM: Hide CPACK_RPM_ROOTDIR debug if not CPACK_RPM_PACKAGE_DEBUG diff --git a/Modules/Internal/CPack/CPackRPM.cmake b/Modules/Internal/CPack/CPackRPM.cmake index 26b2517..ffb24e2 100644 --- a/Modules/Internal/CPack/CPackRPM.cmake +++ b/Modules/Internal/CPack/CPackRPM.cmake @@ -1158,7 +1158,9 @@ function(cpack_rpm_generate_package) # Now we may create the RPM build tree structure set(CPACK_RPM_ROOTDIR "${CPACK_TOPLEVEL_DIRECTORY}") - message(STATUS "CPackRPM:Debug: Using CPACK_RPM_ROOTDIR=${CPACK_RPM_ROOTDIR}") + if(CPACK_RPM_PACKAGE_DEBUG) + message("CPackRPM:Debug: Using CPACK_RPM_ROOTDIR=${CPACK_RPM_ROOTDIR}") + endif() # Prepare RPM build tree file(MAKE_DIRECTORY ${CPACK_RPM_ROOTDIR}) file(MAKE_DIRECTORY ${CPACK_RPM_ROOTDIR}/tmp) https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=3d856eba16fae90f66dd142f91c21d4121b760d0 commit 3d856eba16fae90f66dd142f91c21d4121b760d0 Author: Leonid Pospelov <pospelo...@yandex.ru> AuthorDate: Mon Apr 15 16:34:08 2019 +0300 Commit: Brad King <brad.k...@kitware.com> CommitDate: Mon Apr 22 10:44:31 2019 -0400 cmGeneratorExpressionNode: refactor TargetPropertyNode Re-order logic to improve readability and de-duplicate conditions. Factor out error message generation into a helper. diff --git a/Source/cmGeneratorExpressionNode.cxx b/Source/cmGeneratorExpressionNode.cxx index 5b4e4ed..f661a75 100644 --- a/Source/cmGeneratorExpressionNode.cxx +++ b/Source/cmGeneratorExpressionNode.cxx @@ -1029,62 +1029,44 @@ static const struct TargetPropertyNode : public cmGeneratorExpressionNode // This node handles errors on parameter count itself. int NumExpectedParameters() const override { return OneOrMoreParameters; } + static const char* GetErrorText(std::string const& targetName, + std::string const& propertyName) + { + static cmsys::RegularExpression propertyNameValidator("^[A-Za-z0-9_]+$"); + if (targetName.empty() && propertyName.empty()) { + return "$<TARGET_PROPERTY:tgt,prop> expression requires a non-empty " + "target name and property name."; + } + if (targetName.empty()) { + return "$<TARGET_PROPERTY:tgt,prop> expression requires a non-empty " + "target name."; + } + if (!cmGeneratorExpression::IsValidTargetName(targetName)) { + if (!propertyNameValidator.find(propertyName)) { + return "Target name and property name not supported."; + } + return "Target name not supported."; + } + return nullptr; + } + std::string Evaluate( const std::vector<std::string>& parameters, cmGeneratorExpressionContext* context, const GeneratorExpressionContent* content, cmGeneratorExpressionDAGChecker* dagCheckerParent) const override { - if (parameters.size() != 1 && parameters.size() != 2) { - reportError( - context, content->GetOriginalExpression(), - "$<TARGET_PROPERTY:...> expression requires one or two parameters"); - return std::string(); - } static cmsys::RegularExpression propertyNameValidator("^[A-Za-z0-9_]+$"); - cmGeneratorTarget const* target = context->HeadTarget; - std::string propertyName = parameters.front(); - - if (parameters.size() == 1) { - context->HadHeadSensitiveCondition = true; - } - if (!target && parameters.size() == 1) { - reportError( - context, content->GetOriginalExpression(), - "$<TARGET_PROPERTY:prop> may only be used with binary targets. " - "It may not be used with add_custom_command or add_custom_target. " - "Specify the target to read a property from using the " - "$<TARGET_PROPERTY:tgt,prop> signature instead."); - return std::string(); - } + cmGeneratorTarget const* target = nullptr; + std::string targetName, propertyName; if (parameters.size() == 2) { - if (parameters.front().empty() && parameters[1].empty()) { - reportError( - context, content->GetOriginalExpression(), - "$<TARGET_PROPERTY:tgt,prop> expression requires a non-empty " - "target name and property name."); - return std::string(); - } - if (parameters.front().empty()) { - reportError( - context, content->GetOriginalExpression(), - "$<TARGET_PROPERTY:tgt,prop> expression requires a non-empty " - "target name."); - return std::string(); - } - - std::string targetName = parameters.front(); + targetName = parameters[0]; propertyName = parameters[1]; - if (!cmGeneratorExpression::IsValidTargetName(targetName)) { - if (!propertyNameValidator.find(propertyName)) { - ::reportError(context, content->GetOriginalExpression(), - "Target name and property name not supported."); - return std::string(); - } - ::reportError(context, content->GetOriginalExpression(), - "Target name not supported."); + + if (const char* e = GetErrorText(targetName, propertyName)) { + reportError(context, content->GetOriginalExpression(), e); return std::string(); } if (propertyName == "ALIASED_TARGET"_s) { @@ -1094,7 +1076,7 @@ static const struct TargetPropertyNode : public cmGeneratorExpressionNode return tgt->GetName(); } } - return ""; + return std::string(); } target = context->LG->FindGeneratorTargetToUse(targetName); @@ -1105,15 +1087,34 @@ static const struct TargetPropertyNode : public cmGeneratorExpressionNode return std::string(); } context->AllTargets.insert(target); - } - if (target == context->HeadTarget) { + } else if (parameters.size() == 1) { + target = context->HeadTarget; + propertyName = parameters[0]; + // Keep track of the properties seen while processing. // The evaluation of the LINK_LIBRARIES generator expressions // will check this to ensure that properties have one consistent // value for all evaluations. context->SeenTargetProperties.insert(propertyName); + + context->HadHeadSensitiveCondition = true; + if (!target) { + reportError( + context, content->GetOriginalExpression(), + "$<TARGET_PROPERTY:prop> may only be used with binary targets. " + "It may not be used with add_custom_command or add_custom_target. " + "Specify the target to read a property from using the " + "$<TARGET_PROPERTY:tgt,prop> signature instead."); + return std::string(); + } + } else { + reportError( + context, content->GetOriginalExpression(), + "$<TARGET_PROPERTY:...> expression requires one or two parameters"); + return std::string(); } + if (propertyName == "SOURCES") { context->SourceSensitiveTargets.insert(target); } https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=9e1df5df5479b78d65d37e58b5cd0c93d70838ae commit 9e1df5df5479b78d65d37e58b5cd0c93d70838ae Author: Leonid Pospelov <pospelo...@yandex.ru> AuthorDate: Mon Apr 15 22:55:07 2019 +0300 Commit: Brad King <brad.k...@kitware.com> CommitDate: Mon Apr 22 10:41:28 2019 -0400 cmGeneratorExpressionNode: use ctor arguments instead of macro diff --git a/Source/cmGeneratorExpressionNode.cxx b/Source/cmGeneratorExpressionNode.cxx index 306c9c7..5b4e4ed 100644 --- a/Source/cmGeneratorExpressionNode.cxx +++ b/Source/cmGeneratorExpressionNode.cxx @@ -99,36 +99,42 @@ static const struct OneNode buildInterfaceNode; static const struct ZeroNode installInterfaceNode; -#define BOOLEAN_OP_NODE(OPNAME, OP, SUCCESS_VALUE, FAILURE_VALUE) \ - static const struct OP##Node : public cmGeneratorExpressionNode \ - { \ - OP##Node() {} /* NOLINT(modernize-use-equals-default) */ \ - virtual int NumExpectedParameters() const { return OneOrMoreParameters; } \ - \ - std::string Evaluate(const std::vector<std::string>& parameters, \ - cmGeneratorExpressionContext* context, \ - const GeneratorExpressionContent* content, \ - cmGeneratorExpressionDAGChecker*) const \ - { \ - for (std::string const& param : parameters) { \ - if (param == #FAILURE_VALUE) { \ - return #FAILURE_VALUE; \ - } \ - if (param != #SUCCESS_VALUE) { \ - reportError(context, content->GetOriginalExpression(), \ - "Parameters to $<" #OP \ - "> must resolve to either '0' or '1'."); \ - return std::string(); \ - } \ - } \ - return #SUCCESS_VALUE; \ - } \ - } OPNAME; - -BOOLEAN_OP_NODE(andNode, AND, 1, 0) -BOOLEAN_OP_NODE(orNode, OR, 0, 1) - -#undef BOOLEAN_OP_NODE +struct BooleanOpNode : public cmGeneratorExpressionNode +{ + BooleanOpNode(const char* op_, const char* successVal_, + const char* failureVal_) + : op(op_) + , successVal(successVal_) + , failureVal(failureVal_) + { + } + + int NumExpectedParameters() const override { return OneOrMoreParameters; } + + std::string Evaluate(const std::vector<std::string>& parameters, + cmGeneratorExpressionContext* context, + const GeneratorExpressionContent* content, + cmGeneratorExpressionDAGChecker*) const override + { + for (std::string const& param : parameters) { + if (param == this->failureVal) { + return this->failureVal; + } + if (param != this->successVal) { + std::ostringstream e; + e << "Parameters to $<" << this->op; + e << "> must resolve to either '0' or '1'."; + reportError(context, content->GetOriginalExpression(), e.str()); + return std::string(); + } + } + return this->successVal; + } + + const char *const op, *const successVal, *const failureVal; +}; + +static const BooleanOpNode andNode("AND", "1", "0"), orNode("OR", "0", "1"); static const struct NotNode : public cmGeneratorExpressionNode { https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=36f36d6a49976527a13a77d1ffff1fcdc5c3f5ba commit 36f36d6a49976527a13a77d1ffff1fcdc5c3f5ba Author: Leonid Pospelov <pospelo...@yandex.ru> AuthorDate: Mon Apr 15 15:38:16 2019 +0300 Commit: Brad King <brad.k...@kitware.com> CommitDate: Mon Apr 22 10:41:28 2019 -0400 cmGeneratorExpressionNode: add VersionNode diff --git a/Source/cmGeneratorExpressionNode.cxx b/Source/cmGeneratorExpressionNode.cxx index 5db46dd..306c9c7 100644 --- a/Source/cmGeneratorExpressionNode.cxx +++ b/Source/cmGeneratorExpressionNode.cxx @@ -792,9 +792,10 @@ struct PlatformIdNode : public cmGeneratorExpressionNode } } platformIdNode; -static const struct VersionGreaterNode : public cmGeneratorExpressionNode +template <cmSystemTools::CompareOp Op> +struct VersionNode : public cmGeneratorExpressionNode { - VersionGreaterNode() {} // NOLINT(modernize-use-equals-default) + VersionNode() {} // NOLINT(modernize-use-equals-default) int NumExpectedParameters() const override { return 2; } @@ -804,93 +805,18 @@ static const struct VersionGreaterNode : public cmGeneratorExpressionNode const GeneratorExpressionContent* /*content*/, cmGeneratorExpressionDAGChecker* /*dagChecker*/) const override { - return cmSystemTools::VersionCompare(cmSystemTools::OP_GREATER, - parameters.front().c_str(), - parameters[1].c_str()) - ? "1" - : "0"; - } -} versionGreaterNode; - -static const struct VersionGreaterEqNode : public cmGeneratorExpressionNode -{ - VersionGreaterEqNode() {} // NOLINT(modernize-use-equals-default) - - int NumExpectedParameters() const override { return 2; } - - std::string Evaluate( - const std::vector<std::string>& parameters, - cmGeneratorExpressionContext* /*context*/, - const GeneratorExpressionContent* /*content*/, - cmGeneratorExpressionDAGChecker* /*dagChecker*/) const override - { - return cmSystemTools::VersionCompare(cmSystemTools::OP_GREATER_EQUAL, - parameters.front().c_str(), - parameters[1].c_str()) - ? "1" - : "0"; - } -} versionGreaterEqNode; - -static const struct VersionLessNode : public cmGeneratorExpressionNode -{ - VersionLessNode() {} // NOLINT(modernize-use-equals-default) - - int NumExpectedParameters() const override { return 2; } - - std::string Evaluate( - const std::vector<std::string>& parameters, - cmGeneratorExpressionContext* /*context*/, - const GeneratorExpressionContent* /*content*/, - cmGeneratorExpressionDAGChecker* /*dagChecker*/) const override - { - return cmSystemTools::VersionCompare(cmSystemTools::OP_LESS, - parameters.front().c_str(), + return cmSystemTools::VersionCompare(Op, parameters.front().c_str(), parameters[1].c_str()) ? "1" : "0"; } -} versionLessNode; - -static const struct VersionLessEqNode : public cmGeneratorExpressionNode -{ - VersionLessEqNode() {} // NOLINT(modernize-use-equals-default) - - int NumExpectedParameters() const override { return 2; } - - std::string Evaluate( - const std::vector<std::string>& parameters, - cmGeneratorExpressionContext* /*context*/, - const GeneratorExpressionContent* /*content*/, - cmGeneratorExpressionDAGChecker* /*dagChecker*/) const override - { - return cmSystemTools::VersionCompare(cmSystemTools::OP_LESS_EQUAL, - parameters.front().c_str(), - parameters[1].c_str()) - ? "1" - : "0"; - } -} versionLessEqNode; - -static const struct VersionEqualNode : public cmGeneratorExpressionNode -{ - VersionEqualNode() {} // NOLINT(modernize-use-equals-default) - - int NumExpectedParameters() const override { return 2; } +}; - std::string Evaluate( - const std::vector<std::string>& parameters, - cmGeneratorExpressionContext* /*context*/, - const GeneratorExpressionContent* /*content*/, - cmGeneratorExpressionDAGChecker* /*dagChecker*/) const override - { - return cmSystemTools::VersionCompare(cmSystemTools::OP_EQUAL, - parameters.front().c_str(), - parameters[1].c_str()) - ? "1" - : "0"; - } -} versionEqualNode; +static const VersionNode<cmSystemTools::OP_GREATER> versionGreaterNode; +static const VersionNode<cmSystemTools::OP_GREATER_EQUAL> versionGreaterEqNode; +static const VersionNode<cmSystemTools::OP_LESS> versionLessNode; +static const VersionNode<cmSystemTools::OP_LESS_EQUAL> versionLessEqNode; +static const VersionNode<cmSystemTools::OP_EQUAL> versionEqualNode; static const struct LinkOnlyNode : public cmGeneratorExpressionNode { https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=3f57787dffa629b7c10ca2a02229b7e1a4bfe1f9 commit 3f57787dffa629b7c10ca2a02229b7e1a4bfe1f9 Author: Leonid Pospelov <pospelo...@yandex.ru> AuthorDate: Mon Apr 15 03:56:02 2019 +0300 Commit: Brad King <brad.k...@kitware.com> CommitDate: Mon Apr 22 10:41:28 2019 -0400 cmGeneratorExpressionNode: remove structs CompilerId*, CompilerVersion* diff --git a/Source/cmGeneratorExpressionNode.cxx b/Source/cmGeneratorExpressionNode.cxx index a665974..5db46dd 100644 --- a/Source/cmGeneratorExpressionNode.cxx +++ b/Source/cmGeneratorExpressionNode.cxx @@ -621,10 +621,31 @@ static const CharacterNode<';'> semicolonNode; struct CompilerIdNode : public cmGeneratorExpressionNode { - CompilerIdNode() {} // NOLINT(modernize-use-equals-default) + CompilerIdNode(const char* compilerLang) + : CompilerLanguage(compilerLang) + { + } int NumExpectedParameters() const override { return OneOrZeroParameters; } + std::string Evaluate( + const std::vector<std::string>& parameters, + cmGeneratorExpressionContext* context, + const GeneratorExpressionContent* content, + cmGeneratorExpressionDAGChecker* dagChecker) const override + { + if (!context->HeadTarget) { + std::ostringstream e; + e << "$<" << this->CompilerLanguage + << "_COMPILER_ID> may only be used with binary targets. It may " + "not be used with add_custom_command or add_custom_target."; + reportError(context, content->GetOriginalExpression(), e.str()); + return {}; + } + return this->EvaluateWithLanguage(parameters, context, content, dagChecker, + this->CompilerLanguage); + } + std::string EvaluateWithLanguage(const std::vector<std::string>& parameters, cmGeneratorExpressionContext* context, const GeneratorExpressionContent* content, @@ -671,77 +692,21 @@ struct CompilerIdNode : public cmGeneratorExpressionNode } return "0"; } -}; - -static const struct CCompilerIdNode : public CompilerIdNode -{ - CCompilerIdNode() {} // NOLINT(modernize-use-equals-default) - std::string Evaluate( - const std::vector<std::string>& parameters, - cmGeneratorExpressionContext* context, - const GeneratorExpressionContent* content, - cmGeneratorExpressionDAGChecker* dagChecker) const override - { - if (!context->HeadTarget) { - reportError( - context, content->GetOriginalExpression(), - "$<C_COMPILER_ID> may only be used with binary targets. It may " - "not be used with add_custom_command or add_custom_target."); - return std::string(); - } - return this->EvaluateWithLanguage(parameters, context, content, dagChecker, - "C"); - } -} cCompilerIdNode; - -static const struct CXXCompilerIdNode : public CompilerIdNode -{ - CXXCompilerIdNode() {} // NOLINT(modernize-use-equals-default) + const char* const CompilerLanguage; +}; - std::string Evaluate( - const std::vector<std::string>& parameters, - cmGeneratorExpressionContext* context, - const GeneratorExpressionContent* content, - cmGeneratorExpressionDAGChecker* dagChecker) const override - { - if (!context->HeadTarget) { - reportError( - context, content->GetOriginalExpression(), - "$<CXX_COMPILER_ID> may only be used with binary targets. It may " - "not be used with add_custom_command or add_custom_target."); - return std::string(); - } - return this->EvaluateWithLanguage(parameters, context, content, dagChecker, - "CXX"); - } -} cxxCompilerIdNode; +static const CompilerIdNode cCompilerIdNode("C"), cxxCompilerIdNode("CXX"), + cudaCompilerIdNode("CUDA"), fortranCompilerIdNode("Fortran"); -static const struct CUDACompilerIdNode : public CompilerIdNode +struct CompilerVersionNode : public cmGeneratorExpressionNode { - CUDACompilerIdNode() {} // NOLINT(modernize-use-equals-default) - - std::string Evaluate( - const std::vector<std::string>& parameters, - cmGeneratorExpressionContext* context, - const GeneratorExpressionContent* content, - cmGeneratorExpressionDAGChecker* dagChecker) const override + CompilerVersionNode(const char* compilerLang) + : CompilerLanguage(compilerLang) { - if (!context->HeadTarget) { - reportError( - context, content->GetOriginalExpression(), - "$<CUDA_COMPILER_ID> may only be used with binary targets. It may " - "not be used with add_custom_command or add_custom_target."); - return std::string(); - } - return this->EvaluateWithLanguage(parameters, context, content, dagChecker, - "CUDA"); } -} cudaCompilerIdNode; -static const struct FortranCompilerIdNode : public CompilerIdNode -{ - FortranCompilerIdNode() {} // NOLINT(modernize-use-equals-default) + int NumExpectedParameters() const override { return OneOrZeroParameters; } std::string Evaluate( const std::vector<std::string>& parameters, @@ -750,22 +715,16 @@ static const struct FortranCompilerIdNode : public CompilerIdNode cmGeneratorExpressionDAGChecker* dagChecker) const override { if (!context->HeadTarget) { - reportError( - context, content->GetOriginalExpression(), - "$<Fortran_COMPILER_ID> may only be used with binary targets. It may " - "not be used with add_custom_command or add_custom_target."); - return std::string(); + std::ostringstream e; + e << "$<" << this->CompilerLanguage + << "_COMPILER_VERSION> may only be used with binary targets. It " + "may not be used with add_custom_command or add_custom_target."; + reportError(context, content->GetOriginalExpression(), e.str()); + return {}; } return this->EvaluateWithLanguage(parameters, context, content, dagChecker, - "Fortran"); + this->CompilerLanguage); } -} fortranCompilerIdNode; - -struct CompilerVersionNode : public cmGeneratorExpressionNode -{ - CompilerVersionNode() {} // NOLINT(modernize-use-equals-default) - - int NumExpectedParameters() const override { return OneOrZeroParameters; } std::string EvaluateWithLanguage(const std::vector<std::string>& parameters, cmGeneratorExpressionContext* context, @@ -784,7 +743,7 @@ struct CompilerVersionNode : public cmGeneratorExpressionNode if (!compilerIdValidator.find(parameters.front())) { reportError(context, content->GetOriginalExpression(), "Expression syntax not recognized."); - return std::string(); + return {}; } if (compilerVersion.empty()) { return parameters.front().empty() ? "1" : "0"; @@ -796,95 +755,13 @@ struct CompilerVersionNode : public cmGeneratorExpressionNode ? "1" : "0"; } -}; -static const struct CCompilerVersionNode : public CompilerVersionNode -{ - CCompilerVersionNode() {} // NOLINT(modernize-use-equals-default) - - std::string Evaluate( - const std::vector<std::string>& parameters, - cmGeneratorExpressionContext* context, - const GeneratorExpressionContent* content, - cmGeneratorExpressionDAGChecker* dagChecker) const override - { - if (!context->HeadTarget) { - reportError( - context, content->GetOriginalExpression(), - "$<C_COMPILER_VERSION> may only be used with binary targets. It " - "may not be used with add_custom_command or add_custom_target."); - return std::string(); - } - return this->EvaluateWithLanguage(parameters, context, content, dagChecker, - "C"); - } -} cCompilerVersionNode; - -static const struct CXXCompilerVersionNode : public CompilerVersionNode -{ - CXXCompilerVersionNode() {} // NOLINT(modernize-use-equals-default) - - std::string Evaluate( - const std::vector<std::string>& parameters, - cmGeneratorExpressionContext* context, - const GeneratorExpressionContent* content, - cmGeneratorExpressionDAGChecker* dagChecker) const override - { - if (!context->HeadTarget) { - reportError( - context, content->GetOriginalExpression(), - "$<CXX_COMPILER_VERSION> may only be used with binary targets. It " - "may not be used with add_custom_command or add_custom_target."); - return std::string(); - } - return this->EvaluateWithLanguage(parameters, context, content, dagChecker, - "CXX"); - } -} cxxCompilerVersionNode; - -static const struct CUDACompilerVersionNode : public CompilerVersionNode -{ - CUDACompilerVersionNode() {} // NOLINT(modernize-use-equals-default) - - std::string Evaluate( - const std::vector<std::string>& parameters, - cmGeneratorExpressionContext* context, - const GeneratorExpressionContent* content, - cmGeneratorExpressionDAGChecker* dagChecker) const override - { - if (!context->HeadTarget) { - reportError( - context, content->GetOriginalExpression(), - "$<CUDA_COMPILER_VERSION> may only be used with binary targets. It " - "may not be used with add_custom_command or add_custom_target."); - return std::string(); - } - return this->EvaluateWithLanguage(parameters, context, content, dagChecker, - "CUDA"); - } -} cudaCompilerVersionNode; - -static const struct FortranCompilerVersionNode : public CompilerVersionNode -{ - FortranCompilerVersionNode() {} // NOLINT(modernize-use-equals-default) + const char* const CompilerLanguage; +}; - std::string Evaluate( - const std::vector<std::string>& parameters, - cmGeneratorExpressionContext* context, - const GeneratorExpressionContent* content, - cmGeneratorExpressionDAGChecker* dagChecker) const override - { - if (!context->HeadTarget) { - reportError( - context, content->GetOriginalExpression(), - "$<Fortran_COMPILER_VERSION> may only be used with binary targets. " - "It may not be used with add_custom_command or add_custom_target."); - return std::string(); - } - return this->EvaluateWithLanguage(parameters, context, content, dagChecker, - "Fortran"); - } -} fortranCompilerVersionNode; +static const CompilerVersionNode cCompilerVersionNode("C"), + cxxCompilerVersionNode("CXX"), cudaCompilerVersionNode("CUDA"), + fortranCompilerVersionNode("Fortran"); struct PlatformIdNode : public cmGeneratorExpressionNode { https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=20d7c5631e88d80cb683a5e120c0c1e1f077945a commit 20d7c5631e88d80cb683a5e120c0c1e1f077945a Author: Leonid Pospelov <pospelo...@yandex.ru> AuthorDate: Mon Apr 15 03:36:41 2019 +0300 Commit: Brad King <brad.k...@kitware.com> CommitDate: Mon Apr 22 10:41:28 2019 -0400 cmGeneratorExpressionNode: add CharacterNode diff --git a/Source/cmGeneratorExpressionNode.cxx b/Source/cmGeneratorExpressionNode.cxx index 38da8ef..a665974 100644 --- a/Source/cmGeneratorExpressionNode.cxx +++ b/Source/cmGeneratorExpressionNode.cxx @@ -599,9 +599,10 @@ static const struct MakeCIdentifierNode : public cmGeneratorExpressionNode } } makeCIdentifierNode; -static const struct Angle_RNode : public cmGeneratorExpressionNode +template <char C> +struct CharacterNode : public cmGeneratorExpressionNode { - Angle_RNode() {} // NOLINT(modernize-use-equals-default) + CharacterNode() {} // NOLINT(modernize-use-equals-default) int NumExpectedParameters() const override { return 0; } @@ -611,41 +612,12 @@ static const struct Angle_RNode : public cmGeneratorExpressionNode const GeneratorExpressionContent* /*content*/, cmGeneratorExpressionDAGChecker* /*dagChecker*/) const override { - return ">"; + return { C }; } -} angle_rNode; - -static const struct CommaNode : public cmGeneratorExpressionNode -{ - CommaNode() {} // NOLINT(modernize-use-equals-default) - - int NumExpectedParameters() const override { return 0; } - - std::string Evaluate( - const std::vector<std::string>& /*parameters*/, - cmGeneratorExpressionContext* /*context*/, - const GeneratorExpressionContent* /*content*/, - cmGeneratorExpressionDAGChecker* /*dagChecker*/) const override - { - return ","; - } -} commaNode; - -static const struct SemicolonNode : public cmGeneratorExpressionNode -{ - SemicolonNode() {} // NOLINT(modernize-use-equals-default) - - int NumExpectedParameters() const override { return 0; } - - std::string Evaluate( - const std::vector<std::string>& /*parameters*/, - cmGeneratorExpressionContext* /*context*/, - const GeneratorExpressionContent* /*content*/, - cmGeneratorExpressionDAGChecker* /*dagChecker*/) const override - { - return ";"; - } -} semicolonNode; +}; +static const CharacterNode<'>'> angle_rNode; +static const CharacterNode<','> commaNode; +static const CharacterNode<';'> semicolonNode; struct CompilerIdNode : public cmGeneratorExpressionNode { https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=abd62201bd7d10f8eb27229ac3f5e55d52d0659e commit abd62201bd7d10f8eb27229ac3f5e55d52d0659e Author: Leonid Pospelov <pospelo...@yandex.ru> AuthorDate: Mon Apr 15 03:30:50 2019 +0300 Commit: Brad King <brad.k...@kitware.com> CommitDate: Mon Apr 22 10:41:28 2019 -0400 cmGeneratorExpressionNode: simplify code in EqualNode diff --git a/Source/cmGeneratorExpressionNode.cxx b/Source/cmGeneratorExpressionNode.cxx index 1d3295d..38da8ef 100644 --- a/Source/cmGeneratorExpressionNode.cxx +++ b/Source/cmGeneratorExpressionNode.cxx @@ -215,69 +215,44 @@ static const struct EqualNode : public cmGeneratorExpressionNode const GeneratorExpressionContent* content, cmGeneratorExpressionDAGChecker* /*dagChecker*/) const override { - char* pEnd; - - int base = 0; - bool flipSign = false; - - const char* lhs = parameters[0].c_str(); - if (cmHasLiteralPrefix(lhs, "0b") || cmHasLiteralPrefix(lhs, "0B")) { - base = 2; - lhs += 2; - } - if (cmHasLiteralPrefix(lhs, "-0b") || cmHasLiteralPrefix(lhs, "-0B")) { - base = 2; - lhs += 3; - flipSign = true; - } - if (cmHasLiteralPrefix(lhs, "+0b") || cmHasLiteralPrefix(lhs, "+0B")) { - base = 2; - lhs += 3; - } - - long lnum = strtol(lhs, &pEnd, base); - if (pEnd == lhs || *pEnd != '\0' || errno == ERANGE) { - reportError(context, content->GetOriginalExpression(), - "$<EQUAL> parameter " + parameters[0] + - " is not a valid integer."); - return std::string(); - } - - if (flipSign) { - lnum = -lnum; + long numbers[2]; + for (int i = 0; i < 2; ++i) { + if (!ParameterToLong(parameters[i].c_str(), &numbers[i])) { + reportError(context, content->GetOriginalExpression(), + "$<EQUAL> parameter " + parameters[i] + + " is not a valid integer."); + return {}; + } } + return numbers[0] == numbers[1] ? "1" : "0"; + } - base = 0; - flipSign = false; + static bool ParameterToLong(const char* param, long* outResult) + { + const char isNegative = param[0] == '-'; - const char* rhs = parameters[1].c_str(); - if (cmHasLiteralPrefix(rhs, "0b") || cmHasLiteralPrefix(rhs, "0B")) { - base = 2; - rhs += 2; - } - if (cmHasLiteralPrefix(rhs, "-0b") || cmHasLiteralPrefix(rhs, "-0B")) { + int base = 0; + if (cmHasLiteralPrefix(param, "0b") || cmHasLiteralPrefix(param, "0B")) { base = 2; - rhs += 3; - flipSign = true; - } - if (cmHasLiteralPrefix(rhs, "+0b") || cmHasLiteralPrefix(rhs, "+0B")) { + param += 2; + } else if (cmHasLiteralPrefix(param, "-0b") || + cmHasLiteralPrefix(param, "-0B") || + cmHasLiteralPrefix(param, "+0b") || + cmHasLiteralPrefix(param, "+0B")) { base = 2; - rhs += 3; + param += 3; } - long rnum = strtol(rhs, &pEnd, base); - if (pEnd == rhs || *pEnd != '\0' || errno == ERANGE) { - reportError(context, content->GetOriginalExpression(), - "$<EQUAL> parameter " + parameters[1] + - " is not a valid integer."); - return std::string(); + char* pEnd; + long result = strtol(param, &pEnd, base); + if (pEnd == param || *pEnd != '\0' || errno == ERANGE) { + return false; } - - if (flipSign) { - rnum = -rnum; + if (isNegative && result > 0) { + result *= -1; } - - return lnum == rnum ? "1" : "0"; + *outResult = result; + return true; } } equalNode; https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=f2c8ff825995c1425a134e24eee6c4fb73c3a6b2 commit f2c8ff825995c1425a134e24eee6c4fb73c3a6b2 Author: Brad King <brad.k...@kitware.com> AuthorDate: Mon Apr 22 10:40:26 2019 -0400 Commit: Brad King <brad.k...@kitware.com> CommitDate: Mon Apr 22 10:41:10 2019 -0400 cmGeneratorExpressionNode: Simplify static string constant Use our `""_s` user-defined literal to avoid initializing a static std::string. diff --git a/Source/cmGeneratorExpressionNode.cxx b/Source/cmGeneratorExpressionNode.cxx index af409e4..1d3295d 100644 --- a/Source/cmGeneratorExpressionNode.cxx +++ b/Source/cmGeneratorExpressionNode.cxx @@ -21,10 +21,13 @@ #include "cmStateTypes.h" #include "cmSystemTools.h" #include "cmTarget.h" +#include "cm_static_string_view.hxx" +#include "cm_string_view.hxx" #include "cmake.h" #include "cmsys/RegularExpression.hxx" #include "cmsys/String.h" + #include <algorithm> #include <assert.h> #include <errno.h> @@ -1328,8 +1331,7 @@ static const struct TargetPropertyNode : public cmGeneratorExpressionNode "Target name not supported."); return std::string(); } - static const std::string propALIASED_TARGET = "ALIASED_TARGET"; - if (propertyName == propALIASED_TARGET) { + if (propertyName == "ALIASED_TARGET"_s) { if (context->LG->GetMakefile()->IsAlias(targetName)) { if (cmGeneratorTarget* tgt = context->LG->FindGeneratorTargetToUse(targetName)) { ----------------------------------------------------------------------- Summary of changes: Modules/Internal/CPack/CPackRPM.cmake | 4 +- Modules/Platform/Darwin.cmake | 17 +- Source/cmGeneratorExpressionNode.cxx | 591 ++++++++++------------------------ 3 files changed, 191 insertions(+), 421 deletions(-) hooks/post-receive -- CMake _______________________________________________ Cmake-commits mailing list Cmake-commits@cmake.org https://cmake.org/mailman/listinfo/cmake-commits