summaryrefslogtreecommitdiffstats
path: root/Source/cmGeneratorTarget.cxx
diff options
context:
space:
mode:
authorBen Boeckel <ben.boeckel@kitware.com>2020-01-15 20:35:49 (GMT)
committerBen Boeckel <ben.boeckel@kitware.com>2020-01-16 18:56:30 (GMT)
commitdb4780d58408aa592fdfd4524ebdea83c4c8e898 (patch)
tree3122580452a85b82dd8759c443ad7ed0150b393f /Source/cmGeneratorTarget.cxx
parentec479f101f7113d21efd15257461e337ddc4f8b4 (diff)
downloadCMake-db4780d58408aa592fdfd4524ebdea83c4c8e898.zip
CMake-db4780d58408aa592fdfd4524ebdea83c4c8e898.tar.gz
CMake-db4780d58408aa592fdfd4524ebdea83c4c8e898.tar.bz2
cmGeneratorTarget: search for relative paths to the binary directory
Dependencies in the form `./somepath.txt` are not found otherwise because we only match on last-path-component searches and `.` never shows up in a full path as a full component.
Diffstat (limited to 'Source/cmGeneratorTarget.cxx')
-rw-r--r--Source/cmGeneratorTarget.cxx11
1 files changed, 11 insertions, 0 deletions
diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx
index b3fb132..b18d8bf 100644
--- a/Source/cmGeneratorTarget.cxx
+++ b/Source/cmGeneratorTarget.cxx
@@ -2713,6 +2713,17 @@ void cmTargetTraceDependencies::FollowName(std::string const& name)
if (i == this->NameMap.end() || i->first != name) {
// Check if we know how to generate this file.
cmSourcesWithOutput sources = this->Makefile->GetSourcesWithOutput(name);
+ // If we failed to find a target or source and we have a relative path, it
+ // might be a valid source if made relative to the current binary
+ // directory.
+ if (!sources.Target && !sources.Source &&
+ !cmSystemTools::FileIsFullPath(name)) {
+ auto fullname =
+ cmStrCat(this->Makefile->GetCurrentBinaryDirectory(), '/', name);
+ fullname = cmSystemTools::CollapseFullPath(
+ fullname, this->Makefile->GetHomeOutputDirectory());
+ sources = this->Makefile->GetSourcesWithOutput(fullname);
+ }
i = this->NameMap.emplace_hint(i, name, sources);
}
if (cmTarget* t = i->second.Target) {