summaryrefslogtreecommitdiff
path: root/Source/cmTargetPropertyComputer.h
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2021-12-07 15:23:53 -0500
committerBrad King <brad.king@kitware.com>2021-12-08 10:03:48 -0500
commitc749982c13fa00a968fe0b171946b96d0884ea54 (patch)
tree131974537adb1ee54467d2601699a723ff30d710 /Source/cmTargetPropertyComputer.h
parent3d378541bb22f00e3a22bf5f12e97b7943a81294 (diff)
downloadcmake-c749982c13fa00a968fe0b171946b96d0884ea54.tar.gz
cmTargetPropertyComputer: Simplify by restoring use of cmMakefile
Logically revert commit 390a7d8647 (cmTargetPropertyComputer: Implement GetProperty without cmMakefile, 2016-10-13, v3.8.0-rc1~445^2~9). It relied on using `cmListFileBacktrace` to get a scope in which to look up policies. This does remove a backtrace from `LOCATION` property errors at generate time, but the backtrace we reported before was incorrect. It pointed at the addition of a target, not to the reference to the property.
Diffstat (limited to 'Source/cmTargetPropertyComputer.h')
-rw-r--r--Source/cmTargetPropertyComputer.h28
1 files changed, 10 insertions, 18 deletions
diff --git a/Source/cmTargetPropertyComputer.h b/Source/cmTargetPropertyComputer.h
index e61a1fcda0..82c635542b 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);
};