summaryrefslogtreecommitdiff
path: root/Source/cmNinjaUtilityTargetGenerator.cxx
diff options
context:
space:
mode:
authorKyle Edwards <kyle.edwards@kitware.com>2019-11-14 11:38:35 -0500
committerKyle Edwards <kyle.edwards@kitware.com>2019-12-13 10:51:46 -0500
commit3bc63e99e44b3ef82c19d018f939ea839882a131 (patch)
tree3cc8752c0850fc19ec1962580dc91c7cabdeebaf /Source/cmNinjaUtilityTargetGenerator.cxx
parent4047056a5432b6e9f3fb65a1f846a9373cb25460 (diff)
downloadcmake-3bc63e99e44b3ef82c19d018f939ea839882a131.tar.gz
Refactor: Prepare Ninja generator for multi-config
Diffstat (limited to 'Source/cmNinjaUtilityTargetGenerator.cxx')
-rw-r--r--Source/cmNinjaUtilityTargetGenerator.cxx19
1 files changed, 8 insertions, 11 deletions
diff --git a/Source/cmNinjaUtilityTargetGenerator.cxx b/Source/cmNinjaUtilityTargetGenerator.cxx
index 5259037bfd..0592f34396 100644
--- a/Source/cmNinjaUtilityTargetGenerator.cxx
+++ b/Source/cmNinjaUtilityTargetGenerator.cxx
@@ -15,7 +15,6 @@
#include "cmGeneratorTarget.h"
#include "cmGlobalNinjaGenerator.h"
#include "cmLocalNinjaGenerator.h"
-#include "cmMakefile.h"
#include "cmNinjaTypes.h"
#include "cmOutputConverter.h"
#include "cmSourceFile.h"
@@ -31,7 +30,7 @@ cmNinjaUtilityTargetGenerator::cmNinjaUtilityTargetGenerator(
cmNinjaUtilityTargetGenerator::~cmNinjaUtilityTargetGenerator() = default;
-void cmNinjaUtilityTargetGenerator::Generate()
+void cmNinjaUtilityTargetGenerator::Generate(const std::string& config)
{
cmGlobalNinjaGenerator* gg = this->GetGlobalGenerator();
cmLocalNinjaGenerator* lg = this->GetLocalGenerator();
@@ -55,8 +54,8 @@ void cmNinjaUtilityTargetGenerator::Generate()
for (std::vector<cmCustomCommand> const* cmdList : cmdLists) {
for (cmCustomCommand const& ci : *cmdList) {
- cmCustomCommandGenerator ccg(ci, this->GetConfigName(), lg);
- lg->AppendCustomCommandDeps(ccg, deps);
+ cmCustomCommandGenerator ccg(ci, config, lg);
+ lg->AppendCustomCommandDeps(ccg, deps, config);
lg->AppendCustomCommandLines(ccg, commands);
std::vector<std::string> const& ccByproducts = ccg.GetByproducts();
std::transform(ccByproducts.begin(), ccByproducts.end(),
@@ -69,13 +68,11 @@ void cmNinjaUtilityTargetGenerator::Generate()
}
{
- std::string const& config =
- this->GetMakefile()->GetSafeDefinition("CMAKE_BUILD_TYPE");
std::vector<cmSourceFile*> sources;
genTarget->GetSourceFiles(sources, config);
for (cmSourceFile const* source : sources) {
if (cmCustomCommand const* cc = source->GetCustomCommand()) {
- cmCustomCommandGenerator ccg(*cc, this->GetConfigName(), lg);
+ cmCustomCommandGenerator ccg(*cc, config, lg);
lg->AddCustomCommandTarget(cc, genTarget);
// Depend on all custom command outputs.
@@ -89,8 +86,8 @@ void cmNinjaUtilityTargetGenerator::Generate()
}
}
- lg->AppendTargetOutputs(genTarget, phonyBuild.Outputs);
- lg->AppendTargetDepends(genTarget, deps);
+ lg->AppendTargetOutputs(genTarget, phonyBuild.Outputs, config);
+ lg->AppendTargetDepends(genTarget, deps, config);
if (commands.empty()) {
phonyBuild.Comment = "Utility command for " + this->GetTargetName();
@@ -137,12 +134,12 @@ void cmNinjaUtilityTargetGenerator::Generate()
}
// Find ADDITIONAL_CLEAN_FILES
- this->AdditionalCleanFiles();
+ this->AdditionalCleanFiles(config);
// Add an alias for the logical target name regardless of what directory
// contains it. Skip this for GLOBAL_TARGET because they are meant to
// be per-directory and have one at the top-level anyway.
if (genTarget->GetType() != cmStateEnums::GLOBAL_TARGET) {
- gg->AddTargetAlias(this->GetTargetName(), genTarget);
+ gg->AddTargetAlias(this->GetTargetName(), genTarget, config);
}
}