diff options
author | Brad King <brad.king@kitware.com> | 2019-09-03 13:37:00 (GMT) |
---|---|---|
committer | Kitware Robot <kwrobot@kitware.com> | 2019-09-03 13:42:15 (GMT) |
commit | 1f7bd0032253296413770567a90a0a88b6cccb34 (patch) | |
tree | 4ad8653e9614c721ed3ce37a09b30be2d2e05159 | |
parent | c4f2f011084a5e64e6f3745071ea56a286758682 (diff) | |
parent | 10507c6dc0918777d43b3f961bd18162866f0bbb (diff) | |
download | CMake-1f7bd0032253296413770567a90a0a88b6cccb34.zip CMake-1f7bd0032253296413770567a90a0a88b6cccb34.tar.gz CMake-1f7bd0032253296413770567a90a0a88b6cccb34.tar.bz2 |
Merge topic 'add-non-empty-configurations-getter'
10507c6dc0 cmMakefile: Add configurations getter with empty configuration default
Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !3759
-rw-r--r-- | Source/cmComputeTargetDepends.cxx | 7 | ||||
-rw-r--r-- | Source/cmFileAPICodemodel.cxx | 13 | ||||
-rw-r--r-- | Source/cmGeneratorTarget.cxx | 28 | ||||
-rw-r--r-- | Source/cmGlobalGenerator.cxx | 15 | ||||
-rw-r--r-- | Source/cmLocalGenerator.cxx | 7 | ||||
-rw-r--r-- | Source/cmMakefile.cxx | 10 | ||||
-rw-r--r-- | Source/cmMakefile.h | 3 |
7 files changed, 34 insertions, 49 deletions
diff --git a/Source/cmComputeTargetDepends.cxx b/Source/cmComputeTargetDepends.cxx index 01d4c07..6bf2f2d 100644 --- a/Source/cmComputeTargetDepends.cxx +++ b/Source/cmComputeTargetDepends.cxx @@ -197,11 +197,8 @@ void cmComputeTargetDepends::CollectTargetDepends(int depender_index) { std::set<cmLinkItem> emitted; - std::vector<std::string> configs; - depender->Makefile->GetConfigurations(configs); - if (configs.empty()) { - configs.emplace_back(); - } + std::vector<std::string> const& configs = + depender->Makefile->GetGeneratorConfigs(); for (std::string const& it : configs) { std::vector<cmSourceFile const*> objectFiles; depender->GetExternalObjects(objectFiles, it); diff --git a/Source/cmFileAPICodemodel.cxx b/Source/cmFileAPICodemodel.cxx index 2aa7fe2..3ac769c 100644 --- a/Source/cmFileAPICodemodel.cxx +++ b/Source/cmFileAPICodemodel.cxx @@ -423,20 +423,17 @@ Json::Value Codemodel::DumpPaths() Json::Value Codemodel::DumpConfigurations() { - std::vector<std::string> configs; + Json::Value configurations = Json::arrayValue; cmGlobalGenerator* gg = this->FileAPI.GetCMakeInstance()->GetGlobalGenerator(); auto makefiles = gg->GetMakefiles(); if (!makefiles.empty()) { - makefiles[0]->GetConfigurations(configs); - if (configs.empty()) { - configs.emplace_back(); + std::vector<std::string> const& configs = + makefiles[0]->GetGeneratorConfigs(); + for (std::string const& config : configs) { + configurations.append(this->DumpConfiguration(config)); } } - Json::Value configurations = Json::arrayValue; - for (std::string const& config : configs) { - configurations.append(this->DumpConfiguration(config)); - } return configurations; } diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx index 5fbff2b..b9a9204 100644 --- a/Source/cmGeneratorTarget.cxx +++ b/Source/cmGeneratorTarget.cxx @@ -786,11 +786,8 @@ void cmGeneratorTarget::ComputeObjectMapping() return; } - std::vector<std::string> configs; - this->Makefile->GetConfigurations(configs); - if (configs.empty()) { - configs.emplace_back(); - } + std::vector<std::string> const& configs = + this->Makefile->GetGeneratorConfigs(); for (std::string const& c : configs) { std::vector<cmSourceFile const*> sourceFiles; this->GetObjectSources(sourceFiles, c); @@ -2634,12 +2631,9 @@ cmTargetTraceDependencies::cmTargetTraceDependencies(cmGeneratorTarget* target) // Queue all the source files already specified for the target. if (target->GetType() != cmStateEnums::INTERFACE_LIBRARY) { - std::vector<std::string> configs; - this->Makefile->GetConfigurations(configs); - if (configs.empty()) { - configs.emplace_back(); - } std::set<cmSourceFile*> emitted; + std::vector<std::string> const& configs = + this->Makefile->GetGeneratorConfigs(); for (std::string const& c : configs) { std::vector<cmSourceFile*> sources; this->GeneratorTarget->GetSourceFiles(sources, c); @@ -2825,12 +2819,9 @@ void cmTargetTraceDependencies::CheckCustomCommand(cmCustomCommand const& cc) } // Queue the custom command dependencies. - std::vector<std::string> configs; std::set<std::string> emitted; - this->Makefile->GetConfigurations(configs); - if (configs.empty()) { - configs.emplace_back(); - } + std::vector<std::string> const& configs = + this->Makefile->GetGeneratorConfigs(); for (std::string const& conf : configs) { this->FollowCommandDepends(cc, conf, emitted); } @@ -6077,11 +6068,8 @@ const cmLinkImplementation* cmGeneratorTarget::GetLinkImplementation( bool cmGeneratorTarget::GetConfigCommonSourceFiles( std::vector<cmSourceFile*>& files) const { - std::vector<std::string> configs; - this->Makefile->GetConfigurations(configs); - if (configs.empty()) { - configs.emplace_back(); - } + std::vector<std::string> const& configs = + this->Makefile->GetGeneratorConfigs(); std::vector<std::string>::const_iterator it = configs.begin(); const std::string& firstConfig = *it; diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx index bfccb12..9479424 100644 --- a/Source/cmGlobalGenerator.cxx +++ b/Source/cmGlobalGenerator.cxx @@ -337,12 +337,8 @@ bool cmGlobalGenerator::CheckTargetsForType() const for (cmGeneratorTarget* target : generator->GetGeneratorTargets()) { if (target->GetType() == cmStateEnums::EXECUTABLE && target->GetPropertyAsBool("WIN32_EXECUTABLE")) { - std::vector<std::string> configs; - target->Makefile->GetConfigurations(configs); - if (configs.empty()) { - configs.emplace_back(); - } - + std::vector<std::string> const& configs = + target->Makefile->GetGeneratorConfigs(); for (std::string const& config : configs) { if (target->GetLinkerLanguage(config) == "Swift") { this->GetCMakeInstance()->IssueMessage( @@ -2963,11 +2959,8 @@ void cmGlobalGenerator::WriteSummary(cmGeneratorTarget* target) // List the source files with any per-source labels. fout << "# Source files and their labels\n"; std::vector<cmSourceFile*> sources; - std::vector<std::string> configs; - target->Target->GetMakefile()->GetConfigurations(configs); - if (configs.empty()) { - configs.emplace_back(); - } + std::vector<std::string> const& configs = + target->Target->GetMakefile()->GetGeneratorConfigs(); for (std::string const& c : configs) { target->GetSourceFiles(sources, c); } diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx index 78133db..df1a5bd 100644 --- a/Source/cmLocalGenerator.cxx +++ b/Source/cmLocalGenerator.cxx @@ -257,11 +257,8 @@ static void MoveSystemIncludesToEnd(std::vector<BT<std::string>>& includeDirs, void cmLocalGenerator::TraceDependencies() { - std::vector<std::string> configs; - this->Makefile->GetConfigurations(configs); - if (configs.empty()) { - configs.emplace_back(); - } + std::vector<std::string> const& configs = + this->Makefile->GetGeneratorConfigs(); for (std::string const& c : configs) { this->GlobalGenerator->CreateEvaluationSourceFiles(c); } diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index 5f09ce3..4b26ec6 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -3057,6 +3057,16 @@ std::string cmMakefile::GetConfigurations(std::vector<std::string>& configs, return buildType; } +std::vector<std::string> cmMakefile::GetGeneratorConfigs() const +{ + std::vector<std::string> configs; + GetConfigurations(configs); + if (configs.empty()) { + configs.emplace_back(); + } + return configs; +} + bool cmMakefile::IsFunctionBlocked(const cmListFileFunction& lff, cmExecutionStatus& status) { diff --git a/Source/cmMakefile.h b/Source/cmMakefile.h index dcc4e77..6b9fa6b 100644 --- a/Source/cmMakefile.h +++ b/Source/cmMakefile.h @@ -292,6 +292,9 @@ public: std::string GetConfigurations(std::vector<std::string>& configs, bool single = true) const; + /** Get the configurations for dependency checking. */ + std::vector<std::string> GetGeneratorConfigs() const; + /** * Set the name of the library. */ |