diff options
-rw-r--r-- | Source/cmGeneratorTarget.cxx | 9 | ||||
-rw-r--r-- | Source/cmGetPropertyCommand.cxx | 8 | ||||
-rw-r--r-- | Source/cmGetTargetPropertyCommand.cxx | 7 | ||||
-rw-r--r-- | Source/cmTarget.cxx | 15 | ||||
-rw-r--r-- | Source/cmTarget.h | 12 | ||||
-rw-r--r-- | Source/cmTargetDepend.h | 2 | ||||
-rw-r--r-- | Source/cmTargetPropertyComputer.cxx | 10 | ||||
-rw-r--r-- | Source/cmTargetPropertyComputer.h | 28 | ||||
-rw-r--r-- | Tests/RunCMake/GeneratorExpression/TARGET_PROPERTY-LOCATION-stderr.txt | 6 |
9 files changed, 37 insertions, 60 deletions
diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx index 2fedbd1..e516e53 100644 --- a/Source/cmGeneratorTarget.cxx +++ b/Source/cmGeneratorTarget.cxx @@ -52,8 +52,6 @@ #include "cmTargetPropertyComputer.h" #include "cmake.h" -class cmMessenger; - namespace { const cmsys::RegularExpression FrameworkRegularExpression( "^(.*/)?([^/]*)\\.framework/(.*)$"); @@ -61,8 +59,7 @@ const cmsys::RegularExpression FrameworkRegularExpression( template <> cmValue cmTargetPropertyComputer::GetSources<cmGeneratorTarget>( - cmGeneratorTarget const* tgt, cmMessenger* /* messenger */, - cmListFileBacktrace const& /* context */) + cmGeneratorTarget const* tgt, cmMakefile const& /* mf */) { return tgt->GetSourcesProperty(); } @@ -439,8 +436,8 @@ std::string cmGeneratorTarget::GetExportName() const cmValue cmGeneratorTarget::GetProperty(const std::string& prop) const { - if (cmValue result = cmTargetPropertyComputer::GetProperty( - this, prop, this->Makefile->GetMessenger(), this->GetBacktrace())) { + if (cmValue result = + cmTargetPropertyComputer::GetProperty(this, prop, *this->Makefile)) { return result; } if (cmSystemTools::GetFatalErrorOccured()) { diff --git a/Source/cmGetPropertyCommand.cxx b/Source/cmGetPropertyCommand.cxx index 162860a..b74ed48 100644 --- a/Source/cmGetPropertyCommand.cxx +++ b/Source/cmGetPropertyCommand.cxx @@ -7,7 +7,6 @@ #include "cmExecutionStatus.h" #include "cmGlobalGenerator.h" #include "cmInstalledFile.h" -#include "cmListFileCache.h" #include "cmMakefile.h" #include "cmMessageType.h" #include "cmPolicies.h" @@ -23,8 +22,6 @@ #include "cmValue.h" #include "cmake.h" -class cmMessenger; - namespace { enum OutType { @@ -365,9 +362,8 @@ bool HandleTargetMode(cmExecutionStatus& status, const std::string& name, } return StoreResult(infoType, status.GetMakefile(), variable, nullptr); } - cmListFileBacktrace bt = status.GetMakefile().GetBacktrace(); - cmMessenger* messenger = status.GetMakefile().GetMessenger(); - cmValue prop = target->GetComputedProperty(propertyName, messenger, bt); + cmValue prop = + target->GetComputedProperty(propertyName, status.GetMakefile()); if (!prop) { prop = target->GetProperty(propertyName); } diff --git a/Source/cmGetTargetPropertyCommand.cxx b/Source/cmGetTargetPropertyCommand.cxx index 12c8221..e1ae9b2 100644 --- a/Source/cmGetTargetPropertyCommand.cxx +++ b/Source/cmGetTargetPropertyCommand.cxx @@ -6,15 +6,12 @@ #include "cmExecutionStatus.h" #include "cmGlobalGenerator.h" -#include "cmListFileCache.h" #include "cmMakefile.h" #include "cmMessageType.h" #include "cmPolicies.h" #include "cmTarget.h" #include "cmValue.h" -class cmMessenger; - bool cmGetTargetPropertyCommand(std::vector<std::string> const& args, cmExecutionStatus& status) { @@ -43,9 +40,7 @@ bool cmGetTargetPropertyCommand(std::vector<std::string> const& args, } } else if (!args[2].empty()) { cmValue prop_cstr = nullptr; - cmListFileBacktrace bt = mf.GetBacktrace(); - cmMessenger* messenger = mf.GetMessenger(); - prop_cstr = tgt->GetComputedProperty(args[2], messenger, bt); + prop_cstr = tgt->GetComputedProperty(args[2], mf); if (!prop_cstr) { prop_cstr = tgt->GetProperty(args[2]); } diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx index efae691..ebf5bd0 100644 --- a/Source/cmTarget.cxx +++ b/Source/cmTarget.cxx @@ -27,7 +27,6 @@ #include "cmListFileCache.h" #include "cmMakefile.h" #include "cmMessageType.h" -#include "cmMessenger.h" #include "cmProperty.h" #include "cmPropertyMap.h" #include "cmRange.h" @@ -82,9 +81,8 @@ const std::string& cmTargetPropertyComputer::ComputeLocation<cmTarget>( } template <> -cmValue cmTargetPropertyComputer::GetSources<cmTarget>( - cmTarget const* tgt, cmMessenger* messenger, - cmListFileBacktrace const& context) +cmValue cmTargetPropertyComputer::GetSources<cmTarget>(cmTarget const* tgt, + cmMakefile const& mf) { cmBTStringRange entries = tgt->GetSourceEntries(); if (entries.empty()) { @@ -111,7 +109,7 @@ cmValue cmTargetPropertyComputer::GetSources<cmTarget>( bool noMessage = true; std::ostringstream e; MessageType messageType = MessageType::AUTHOR_WARNING; - switch (context.GetBottom().GetPolicy(cmPolicies::CMP0051)) { + switch (mf.GetPolicyStatus(cmPolicies::CMP0051)) { case cmPolicies::WARN: e << cmPolicies::GetPolicyWarning(cmPolicies::CMP0051) << "\n"; noMessage = false; @@ -132,7 +130,7 @@ cmValue cmTargetPropertyComputer::GetSources<cmTarget>( "time. Code reading that property needs to be adapted to " "ignore the generator expression using the string(GENEX_STRIP) " "command."; - messenger->IssueMessage(messageType, e.str(), context); + mf.IssueMessage(messageType, e.str()); } if (addContent) { ss << sep; @@ -1813,10 +1811,9 @@ void cmTarget::CheckProperty(const std::string& prop, } cmValue cmTarget::GetComputedProperty(const std::string& prop, - cmMessenger* messenger, - cmListFileBacktrace const& context) const + cmMakefile& mf) const { - return cmTargetPropertyComputer::GetProperty(this, prop, messenger, context); + return cmTargetPropertyComputer::GetProperty(this, prop, mf); } cmValue cmTarget::GetProperty(const std::string& prop) const diff --git a/Source/cmTarget.h b/Source/cmTarget.h index 27b325a..c4314a4 100644 --- a/Source/cmTarget.h +++ b/Source/cmTarget.h @@ -12,7 +12,6 @@ #include <vector> #include "cmAlgorithms.h" -#include "cmListFileCache.h" #include "cmPolicies.h" #include "cmStateTypes.h" #include "cmStringAlgorithms.h" @@ -23,12 +22,18 @@ class cmCustomCommand; class cmFileSet; class cmGlobalGenerator; class cmInstallTargetGenerator; +class cmListFileBacktrace; +class cmListFileContext; class cmMakefile; -class cmMessenger; class cmPropertyMap; class cmSourceFile; class cmTargetInternals; +template <typename T> +class BT; +template <typename T> +class BTs; + /** \class cmTarget * \brief Represent a library or executable target loaded from a makefile. * @@ -184,8 +189,7 @@ public: std::string const& GetSafeProperty(std::string const& prop) const; bool GetPropertyAsBool(const std::string& prop) const; void CheckProperty(const std::string& prop, cmMakefile* context) const; - cmValue GetComputedProperty(const std::string& prop, cmMessenger* messenger, - cmListFileBacktrace const& context) const; + cmValue GetComputedProperty(const std::string& prop, cmMakefile& mf) const; //! Get all properties cmPropertyMap const& GetProperties() const; diff --git a/Source/cmTargetDepend.h b/Source/cmTargetDepend.h index 36702bd..9027409 100644 --- a/Source/cmTargetDepend.h +++ b/Source/cmTargetDepend.h @@ -6,6 +6,8 @@ #include <set> +#include "cmListFileCache.h" + class cmGeneratorTarget; /** One edge in the global target dependency graph. diff --git a/Source/cmTargetPropertyComputer.cxx b/Source/cmTargetPropertyComputer.cxx index 9b94142..134b4b6 100644 --- a/Source/cmTargetPropertyComputer.cxx +++ b/Source/cmTargetPropertyComputer.cxx @@ -5,19 +5,17 @@ #include <sstream> +#include "cmMakefile.h" #include "cmMessageType.h" -#include "cmMessenger.h" #include "cmPolicies.h" -#include "cmStateSnapshot.h" bool cmTargetPropertyComputer::HandleLocationPropertyPolicy( - std::string const& tgtName, cmMessenger* messenger, - cmListFileBacktrace const& context) + std::string const& tgtName, cmMakefile const& mf) { std::ostringstream e; const char* modal = nullptr; MessageType messageType = MessageType::AUTHOR_WARNING; - switch (context.GetBottom().GetPolicy(cmPolicies::CMP0026)) { + switch (mf.GetPolicyStatus(cmPolicies::CMP0026)) { case cmPolicies::WARN: e << cmPolicies::GetPolicyWarning(cmPolicies::CMP0026) << "\n"; modal = "should"; @@ -38,7 +36,7 @@ bool cmTargetPropertyComputer::HandleLocationPropertyPolicy( << "\". Use the target name directly with " "add_custom_command, or use the generator expression $<TARGET_FILE>, " "as appropriate.\n"; - messenger->IssueMessage(messageType, e.str(), context); + mf.IssueMessage(messageType, e.str()); } return messageType != MessageType::FATAL_ERROR; diff --git a/Source/cmTargetPropertyComputer.h b/Source/cmTargetPropertyComputer.h index e61a1fc..82c6355 100644 --- a/Source/cmTargetPropertyComputer.h +++ b/Source/cmTargetPropertyComputer.h @@ -6,38 +6,35 @@ #include <string> -#include "cmListFileCache.h" #include "cmStateTypes.h" #include "cmStringAlgorithms.h" #include "cmSystemTools.h" #include "cmValue.h" -class cmMessenger; +class cmMakefile; class cmTargetPropertyComputer { public: template <typename Target> static cmValue GetProperty(Target const* tgt, const std::string& prop, - cmMessenger* messenger, - cmListFileBacktrace const& context) + cmMakefile const& mf) { - if (cmValue loc = GetLocation(tgt, prop, messenger, context)) { + if (cmValue loc = GetLocation(tgt, prop, mf)) { return loc; } if (cmSystemTools::GetFatalErrorOccured()) { return nullptr; } if (prop == "SOURCES") { - return GetSources(tgt, messenger, context); + return GetSources(tgt, mf); } return nullptr; } private: static bool HandleLocationPropertyPolicy(std::string const& tgtName, - cmMessenger* messenger, - cmListFileBacktrace const& context); + cmMakefile const& mf); template <typename Target> static const std::string& ComputeLocationForBuild(Target const* tgt); @@ -47,8 +44,7 @@ private: template <typename Target> static cmValue GetLocation(Target const* tgt, std::string const& prop, - cmMessenger* messenger, - cmListFileBacktrace const& context) + cmMakefile const& mf) { // Watch for special "computed" properties that are dependent on @@ -61,8 +57,7 @@ private: static const std::string propLOCATION = "LOCATION"; if (prop == propLOCATION) { if (!tgt->IsImported() && - !HandleLocationPropertyPolicy(tgt->GetName(), messenger, - context)) { + !HandleLocationPropertyPolicy(tgt->GetName(), mf)) { return nullptr; } return cmValue(ComputeLocationForBuild(tgt)); @@ -71,8 +66,7 @@ private: // Support "LOCATION_<CONFIG>". if (cmHasLiteralPrefix(prop, "LOCATION_")) { if (!tgt->IsImported() && - !HandleLocationPropertyPolicy(tgt->GetName(), messenger, - context)) { + !HandleLocationPropertyPolicy(tgt->GetName(), mf)) { return nullptr; } std::string configName = prop.substr(9); @@ -85,8 +79,7 @@ private: std::string configName(prop.c_str(), prop.size() - 9); if (configName != "IMPORTED") { if (!tgt->IsImported() && - !HandleLocationPropertyPolicy(tgt->GetName(), messenger, - context)) { + !HandleLocationPropertyPolicy(tgt->GetName(), mf)) { return nullptr; } return cmValue(ComputeLocation(tgt, configName)); @@ -97,6 +90,5 @@ private: } template <typename Target> - static cmValue GetSources(Target const* tgt, cmMessenger* messenger, - cmListFileBacktrace const& context); + static cmValue GetSources(Target const* tgt, cmMakefile const& mf); }; diff --git a/Tests/RunCMake/GeneratorExpression/TARGET_PROPERTY-LOCATION-stderr.txt b/Tests/RunCMake/GeneratorExpression/TARGET_PROPERTY-LOCATION-stderr.txt index d4e5b29..a4c8dcd 100644 --- a/Tests/RunCMake/GeneratorExpression/TARGET_PROPERTY-LOCATION-stderr.txt +++ b/Tests/RunCMake/GeneratorExpression/TARGET_PROPERTY-LOCATION-stderr.txt @@ -1,4 +1,4 @@ -CMake Warning \(dev\) at TARGET_PROPERTY-LOCATION.cmake:2 \(add_library\): +CMake Warning \(dev\) in CMakeLists\.txt: Policy CMP0026 is not set: Disallow use of the LOCATION target property. Run "cmake --help-policy CMP0026" for policy details. Use the cmake_policy command to set the policy and suppress this warning. @@ -6,7 +6,3 @@ CMake Warning \(dev\) at TARGET_PROPERTY-LOCATION.cmake:2 \(add_library\): The LOCATION property should not be read from target "foo". Use the target name directly with add_custom_command, or use the generator expression \$<TARGET_FILE>, as appropriate. - -Call Stack \(most recent call first\): - CMakeLists.txt:3 \(include\) -This warning is for project developers. Use -Wno-dev to suppress it. |