summaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2020-09-22 16:57:50 (GMT)
committerBrad King <brad.king@kitware.com>2020-09-23 13:25:42 (GMT)
commitf2daa025e3bf05f89a745e6a65fea9537e0a035d (patch)
tree2e7528043c7ee905e3777e53e11698f8b81a9a57 /Source
parent0cb7216b9f016d5749209227502e499b53b33841 (diff)
downloadCMake-f2daa025e3bf05f89a745e6a65fea9537e0a035d.zip
CMake-f2daa025e3bf05f89a745e6a65fea9537e0a035d.tar.gz
CMake-f2daa025e3bf05f89a745e6a65fea9537e0a035d.tar.bz2
{get,set}_property: Add support for referencing binary directories
Index directories by their binary directory path in addition to their source directory path. Fixes: #19262
Diffstat (limited to 'Source')
-rw-r--r--Source/cmGlobalGenerator.cxx10
-rw-r--r--Source/cmSetPropertyCommand.cxx2
2 files changed, 6 insertions, 6 deletions
diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx
index ce1a4ec..86b01bc 100644
--- a/Source/cmGlobalGenerator.cxx
+++ b/Source/cmGlobalGenerator.cxx
@@ -2353,13 +2353,13 @@ std::string cmGlobalGenerator::IndexGeneratorTargetUniquely(
void cmGlobalGenerator::IndexMakefile(cmMakefile* mf)
{
- // FIXME: add_subdirectory supports multiple build directories
- // sharing the same source directory. We currently index only the
- // first one, because that is what FindMakefile has always returned.
- // All of its callers will need to be modified to support looking
- // up directories by build directory path.
+ // We index by both source and binary directory. add_subdirectory
+ // supports multiple build directories sharing the same source directory.
+ // The source directory index will reference only the first time it is used.
this->MakefileSearchIndex.insert(
MakefileMap::value_type(mf->GetCurrentSourceDirectory(), mf));
+ this->MakefileSearchIndex.insert(
+ MakefileMap::value_type(mf->GetCurrentBinaryDirectory(), mf));
}
void cmGlobalGenerator::IndexLocalGenerator(cmLocalGenerator* lg)
diff --git a/Source/cmSetPropertyCommand.cxx b/Source/cmSetPropertyCommand.cxx
index 6ca763b..df6a38a 100644
--- a/Source/cmSetPropertyCommand.cxx
+++ b/Source/cmSetPropertyCommand.cxx
@@ -113,7 +113,7 @@ bool HandleSourceFileDirectoryScopes(
"given non-existent target for TARGET_DIRECTORY ", target_name));
return false;
}
- cmProp target_source_dir = target->GetProperty("SOURCE_DIR");
+ cmProp target_source_dir = target->GetProperty("BINARY_DIR");
cmMakefile* target_dir_mf =
status.GetMakefile().GetGlobalGenerator()->FindMakefile(
*target_source_dir);