summaryrefslogtreecommitdiffstats
path: root/Source/cmLocalGenerator.cxx
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2020-10-30 15:48:43 (GMT)
committerBrad King <brad.king@kitware.com>2020-12-15 12:00:53 (GMT)
commit15467f12f796205f97721f43ae7d9ee7cdc47466 (patch)
tree17fb00d71cb6698bd75a03b560faf7eeab557f6c /Source/cmLocalGenerator.cxx
parent7b64b0cd5a4046bf8743c3e2d3c57cb470bfa95f (diff)
downloadCMake-15467f12f796205f97721f43ae7d9ee7cdc47466.zip
CMake-15467f12f796205f97721f43ae7d9ee7cdc47466.tar.gz
CMake-15467f12f796205f97721f43ae7d9ee7cdc47466.tar.bz2
cmLocalGenerator: Adopt custom target 'force' output name generation
Diffstat (limited to 'Source/cmLocalGenerator.cxx')
-rw-r--r--Source/cmLocalGenerator.cxx28
1 files changed, 22 insertions, 6 deletions
diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx
index dc4a3fc..cd18670 100644
--- a/Source/cmLocalGenerator.cxx
+++ b/Source/cmLocalGenerator.cxx
@@ -1129,9 +1129,8 @@ cmTarget* cmLocalGenerator::AddUtilityCommand(
detail::AddUtilityCommand(
*this, this->DirectoryBacktrace, cmCommandOrigin::Generator, target,
- this->Makefile->GetUtilityOutput(target), workingDir, byproducts, depends,
- commandLines, escapeOldStyle, comment, uses_terminal, command_expand_lists,
- job_pool, stdPipesUTF8);
+ workingDir, byproducts, depends, commandLines, escapeOldStyle, comment,
+ uses_terminal, command_expand_lists, job_pool, stdPipesUTF8);
return target;
}
@@ -4115,7 +4114,7 @@ void AppendCustomCommandToOutput(cmLocalGenerator& lg,
void AddUtilityCommand(cmLocalGenerator& lg, const cmListFileBacktrace& lfbt,
cmCommandOrigin origin, cmTarget* target,
- std::string const& force, const char* workingDir,
+ const char* workingDir,
const std::vector<std::string>& byproducts,
const std::vector<std::string>& depends,
const cmCustomCommandLines& commandLines,
@@ -4128,10 +4127,13 @@ void AddUtilityCommand(cmLocalGenerator& lg, const cmListFileBacktrace& lfbt,
comment = "";
}
+ // Create the generated symbolic output name of the utility target.
+ std::string output = lg.CreateUtilityOutput(target->GetName());
+
std::string no_main_dependency;
cmImplicitDependsList no_implicit_depends;
cmSourceFile* rule = AddCustomCommand(
- lg, lfbt, origin, { force }, byproducts, depends, no_main_dependency,
+ lg, lfbt, origin, { output }, byproducts, depends, no_main_dependency,
no_implicit_depends, commandLines, comment, workingDir,
/*replace=*/false, escapeOldStyle, uses_terminal, command_expand_lists,
/*depfile=*/"", job_pool, stdPipesUTF8);
@@ -4139,7 +4141,7 @@ void AddUtilityCommand(cmLocalGenerator& lg, const cmListFileBacktrace& lfbt,
lg.AddTargetByproducts(target, byproducts, lfbt, origin);
}
- target->AddSource(force);
+ target->AddSource(output);
}
std::vector<std::string> ComputeISPCObjectSuffixes(cmGeneratorTarget* target)
@@ -4232,6 +4234,20 @@ cmSourceFile* cmLocalGenerator::GetSourceFileWithOutput(
return nullptr;
}
+std::string cmLocalGenerator::CreateUtilityOutput(
+ std::string const& targetName)
+{
+ std::string force =
+ cmStrCat(this->GetCurrentBinaryDirectory(), "/CMakeFiles/", targetName);
+ // The output is not actually created so mark it symbolic.
+ if (cmSourceFile* sf = this->Makefile->GetOrCreateGeneratedSource(force)) {
+ sf->SetProperty("SYMBOLIC", "1");
+ } else {
+ cmSystemTools::Error("Could not get source file entry for " + force);
+ }
+ return force;
+}
+
std::vector<cmCustomCommandGenerator>
cmLocalGenerator::MakeCustomCommandGenerators(cmCustomCommand const& cc,
std::string const& config)