From aaa322a5cb5603742273282fb12f1e368697a625 Mon Sep 17 00:00:00 2001 From: Brad King Date: Wed, 29 Jul 2015 10:41:30 -0400 Subject: cmMakefile: Return target from all AddUtilityCommand signatures --- Source/cmMakefile.cxx | 23 ++++++++++++----------- Source/cmMakefile.h | 17 +++++++++-------- 2 files changed, 21 insertions(+), 19 deletions(-) diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index 57e33df..17bde41 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -1205,15 +1205,16 @@ cmMakefile::AddCustomCommandOldStyle(const std::string& target, } //---------------------------------------------------------------------------- -void cmMakefile::AddUtilityCommand(const std::string& utilityName, - bool excludeFromAll, - const std::vector& depends, - const char* workingDirectory, - const char* command, - const char* arg1, - const char* arg2, - const char* arg3, - const char* arg4) +cmTarget* +cmMakefile::AddUtilityCommand(const std::string& utilityName, + bool excludeFromAll, + const std::vector& depends, + const char* workingDirectory, + const char* command, + const char* arg1, + const char* arg2, + const char* arg3, + const char* arg4) { // Construct the command line for the custom command. cmCustomCommandLine commandLine; @@ -1238,8 +1239,8 @@ void cmMakefile::AddUtilityCommand(const std::string& utilityName, commandLines.push_back(commandLine); // Call the real signature of this method. - this->AddUtilityCommand(utilityName, excludeFromAll, workingDirectory, - depends, commandLines); + return this->AddUtilityCommand(utilityName, excludeFromAll, workingDirectory, + depends, commandLines); } //---------------------------------------------------------------------------- diff --git a/Source/cmMakefile.h b/Source/cmMakefile.h index 7938fcc..4fa5822 100644 --- a/Source/cmMakefile.h +++ b/Source/cmMakefile.h @@ -194,14 +194,15 @@ public: * Add a utility to the build. A utiltity target is a command that * is run every time the target is built. */ - void AddUtilityCommand(const std::string& utilityName, bool excludeFromAll, - const std::vector& depends, - const char* workingDirectory, - const char* command, - const char* arg1=0, - const char* arg2=0, - const char* arg3=0, - const char* arg4=0); + cmTarget* AddUtilityCommand(const std::string& utilityName, + bool excludeFromAll, + const std::vector& depends, + const char* workingDirectory, + const char* command, + const char* arg1=0, + const char* arg2=0, + const char* arg3=0, + const char* arg4=0); cmTarget* AddUtilityCommand(const std::string& utilityName, bool excludeFromAll, const char* workingDirectory, -- cgit v0.12 From 34b902a5a6fd55ef3857d74aab986a8d96d57659 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Tue, 28 Jul 2015 18:30:15 +0200 Subject: cmMakefile: Move method out of line. --- Source/cmMakefile.cxx | 5 +++++ Source/cmMakefile.h | 5 +---- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index 17bde41..20c56ba 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -1906,6 +1906,11 @@ const char* cmMakefile::GetCurrentBinaryDirectory() const return this->StateSnapshot.GetDirectory().GetCurrentBinary(); } +void cmMakefile::AddGeneratorTarget(cmTarget* t, cmGeneratorTarget* gt) +{ + this->GeneratorTargets[t] = gt; +} + //---------------------------------------------------------------------------- void cmMakefile::AddIncludeDirectories(const std::vector &incs, bool before) diff --git a/Source/cmMakefile.h b/Source/cmMakefile.h index 4fa5822..1e5c301 100644 --- a/Source/cmMakefile.h +++ b/Source/cmMakefile.h @@ -417,10 +417,7 @@ public: { this->GeneratorTargets = targets; } - void AddGeneratorTarget(cmTarget* t, cmGeneratorTarget* gt) - { - this->GeneratorTargets[t] = gt; - } + void AddGeneratorTarget(cmTarget* t, cmGeneratorTarget* gt); cmTarget* FindTarget(const std::string& name, bool excludeAliases = false) const; -- cgit v0.12 From 32e4f6beca6f13165ec5a40bf363d005ebda9263 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Tue, 28 Jul 2015 18:37:55 +0200 Subject: Xcode: Skip Global targets when processing. --- Source/cmGlobalXCodeGenerator.cxx | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx index ba5ff30..d6f5a00 100644 --- a/Source/cmGlobalXCodeGenerator.cxx +++ b/Source/cmGlobalXCodeGenerator.cxx @@ -502,6 +502,11 @@ cmGlobalXCodeGenerator::AddExtraTargets(cmLocalGenerator* root, { cmTarget& target = l->second; + if (target.GetType() == cmTarget::GLOBAL_TARGET) + { + continue; + } + if (regenerate && (l->first != CMAKE_CHECK_BUILD_SYSTEM_TARGET)) { target.AddUtility(CMAKE_CHECK_BUILD_SYSTEM_TARGET); -- cgit v0.12 From a1209be550172a95d3254158c121abf184e60bcd Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Tue, 28 Jul 2015 18:48:40 +0200 Subject: VisualStudio: Skip global targets when processing. --- Source/cmGlobalVisualStudioGenerator.cxx | 4 ++++ Source/cmLocalVisualStudio6Generator.cxx | 3 ++- Source/cmLocalVisualStudio7Generator.cxx | 4 ++++ 3 files changed, 10 insertions(+), 1 deletion(-) diff --git a/Source/cmGlobalVisualStudioGenerator.cxx b/Source/cmGlobalVisualStudioGenerator.cxx index 1d583eb..d6973aa 100644 --- a/Source/cmGlobalVisualStudioGenerator.cxx +++ b/Source/cmGlobalVisualStudioGenerator.cxx @@ -108,6 +108,10 @@ void cmGlobalVisualStudioGenerator::Generate() for(cmTargets::iterator t = targets.begin(); t != targets.end(); ++t) { + if (t->second.GetType() == cmTarget::GLOBAL_TARGET) + { + continue; + } if(!this->IsExcluded(gen[0], t->second)) { allBuild->AddUtility(t->second.GetName()); diff --git a/Source/cmLocalVisualStudio6Generator.cxx b/Source/cmLocalVisualStudio6Generator.cxx index f1c8def..cab5a47 100644 --- a/Source/cmLocalVisualStudio6Generator.cxx +++ b/Source/cmLocalVisualStudio6Generator.cxx @@ -88,7 +88,8 @@ void cmLocalVisualStudio6Generator::AddCMakeListsRules() for(cmTargets::iterator l = tgts.begin(); l != tgts.end(); l++) { - if (l->second.GetType() == cmTarget::INTERFACE_LIBRARY) + if (l->second.GetType() == cmTarget::INTERFACE_LIBRARY + || l->second.GetType() == cmTarget::GLOBAL_TARGET) { continue; } diff --git a/Source/cmLocalVisualStudio7Generator.cxx b/Source/cmLocalVisualStudio7Generator.cxx index f199a41..572dbde 100644 --- a/Source/cmLocalVisualStudio7Generator.cxx +++ b/Source/cmLocalVisualStudio7Generator.cxx @@ -108,6 +108,10 @@ void cmLocalVisualStudio7Generator::AddCMakeListsRules() // Add the rule to targets that need it. for(cmTargets::iterator l = tgts.begin(); l != tgts.end(); ++l) { + if (l->second.GetType() == cmTarget::GLOBAL_TARGET) + { + continue; + } if(l->first != CMAKE_CHECK_BUILD_SYSTEM_TARGET) { l->second.AddSource(sf->GetFullPath()); -- cgit v0.12 From 5c14f78005ba5b4a2ccf0899fc50805a9de7b9ee Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Sat, 25 Jul 2015 19:08:08 +0200 Subject: cmGlobalGenerator: Remove unused manifest accessor. --- Source/cmGlobalGenerator.h | 5 ----- 1 file changed, 5 deletions(-) diff --git a/Source/cmGlobalGenerator.h b/Source/cmGlobalGenerator.h index d486003..e517c5c 100644 --- a/Source/cmGlobalGenerator.h +++ b/Source/cmGlobalGenerator.h @@ -264,11 +264,6 @@ public: const std::string& suffix, std::string& dir); - /** Get the manifest of all targets that will be built for each - configuration. This is valid during generation only. */ - cmTargetManifest const& GetTargetManifest() const - { return this->TargetManifest; } - /** Get the content of a directory. Directory listings are cached and re-loaded from disk only when modified. During the generation step the content will include the target files to be built even if -- cgit v0.12 From 1ef9b2b6007356ab26cdec42bdf9c79d53745bf6 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Sat, 25 Jul 2015 19:10:44 +0200 Subject: cmGlobalGenerator: Remove the TargetManifest member. --- Source/cmGeneratorTarget.cxx | 10 +++++----- Source/cmGlobalGenerator.cxx | 6 +----- Source/cmGlobalGenerator.h | 6 +----- 3 files changed, 7 insertions(+), 15 deletions(-) diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx index edd89e8..bd57b3d 100644 --- a/Source/cmGeneratorTarget.cxx +++ b/Source/cmGeneratorTarget.cxx @@ -1150,35 +1150,35 @@ void cmGeneratorTarget::GenerateTargetManifest( f = dir; f += "/"; f += name; - gg->AddToManifest(config, f); + gg->AddToManifest(f); } if(!soName.empty()) { f = dir; f += "/"; f += soName; - gg->AddToManifest(config, f); + gg->AddToManifest(f); } if(!realName.empty()) { f = dir; f += "/"; f += realName; - gg->AddToManifest(config, f); + gg->AddToManifest(f); } if(!pdbName.empty()) { f = dir; f += "/"; f += pdbName; - gg->AddToManifest(config, f); + gg->AddToManifest(f); } if(!impName.empty()) { f = this->Target->GetDirectory(config, true); f += "/"; f += impName; - gg->AddToManifest(config, f); + gg->AddToManifest(f); } } diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx index 5599854..06777e6 100644 --- a/Source/cmGlobalGenerator.cxx +++ b/Source/cmGlobalGenerator.cxx @@ -2698,12 +2698,8 @@ void cmGlobalGenerator::AddTargetDepends(cmGeneratorTarget const* target, //---------------------------------------------------------------------------- -void cmGlobalGenerator::AddToManifest(const std::string& config, - std::string const& f) +void cmGlobalGenerator::AddToManifest(std::string const& f) { - // Add to the main manifest for this configuration. - this->TargetManifest[config].insert(f); - // Add to the content listing for the file's directory. std::string dir = cmSystemTools::GetFilenamePath(f); std::string file = cmSystemTools::GetFilenameName(f); diff --git a/Source/cmGlobalGenerator.h b/Source/cmGlobalGenerator.h index e517c5c..fe99a00 100644 --- a/Source/cmGlobalGenerator.h +++ b/Source/cmGlobalGenerator.h @@ -200,7 +200,7 @@ public: cmExportSetMap& GetExportSets() {return this->ExportSets;} /** Add a file to the manifest of generated targets for a configuration. */ - void AddToManifest(const std::string& config, std::string const& f); + void AddToManifest(std::string const& f); void EnableInstallTarget(); @@ -424,10 +424,6 @@ protected: std::map BuildExportSets; std::map BuildExportExportSets; - // Manifest of all targets that will be built for each configuration. - // This is computed just before local generators generate. - cmTargetManifest TargetManifest; - // All targets in the entire project. #if defined(CMAKE_BUILD_WITH_CMAKE) #ifdef CMake_HAVE_CXX11_UNORDERED_MAP -- cgit v0.12 From 29e8b7bfcc8b3530fb4fd2dd04dca59744588b61 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Sat, 25 Jul 2015 18:43:28 +0200 Subject: cmGlobalGenerator: Create a new Compute step before generation. Replace the DoGenerate method. --- Source/cmGlobalGenerator.cxx | 4 +--- Source/cmGlobalGenerator.h | 5 ++--- Source/cmake.cxx | 3 ++- 3 files changed, 5 insertions(+), 7 deletions(-) diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx index 06777e6..390d6b4 100644 --- a/Source/cmGlobalGenerator.cxx +++ b/Source/cmGlobalGenerator.cxx @@ -1212,7 +1212,7 @@ bool cmGlobalGenerator::CheckALLOW_DUPLICATE_CUSTOM_TARGETS() const return false; } -void cmGlobalGenerator::DoGenerate() +void cmGlobalGenerator::Compute() { // Some generators track files replaced during the Generate. // Start with an empty vector: @@ -1220,8 +1220,6 @@ void cmGlobalGenerator::DoGenerate() // clear targets to issue warning CMP0042 for this->CMP0042WarnTargets.clear(); - - this->Generate(); } void cmGlobalGenerator::Generate() diff --git a/Source/cmGlobalGenerator.h b/Source/cmGlobalGenerator.h index fe99a00..9c36cca 100644 --- a/Source/cmGlobalGenerator.h +++ b/Source/cmGlobalGenerator.h @@ -86,6 +86,7 @@ public: */ virtual void Configure(); + void Compute(); enum TargetTypes { AllTargets, @@ -99,7 +100,7 @@ public: * basically creates a series of LocalGenerators for each directory and * requests that they Generate. */ - void DoGenerate(); + virtual void Generate(); /** * Set/Get and Clear the enabled languages. @@ -368,8 +369,6 @@ public: std::string MakeSilentFlag; protected: - virtual void Generate(); - typedef std::vector GeneratorVector; // for a project collect all its targets by following depend // information, and also collect all the targets diff --git a/Source/cmake.cxx b/Source/cmake.cxx index 9d2c19e..619374e 100644 --- a/Source/cmake.cxx +++ b/Source/cmake.cxx @@ -1607,7 +1607,8 @@ int cmake::Generate() { return -1; } - this->GlobalGenerator->DoGenerate(); + this->GlobalGenerator->Compute(); + this->GlobalGenerator->Generate(); if ( !this->GraphVizFile.empty() ) { std::cout << "Generate graphviz: " << this->GraphVizFile << std::endl; -- cgit v0.12 From fb9355c50e366bd0f7cb6df6ea19118bd7dae899 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Sat, 25 Jul 2015 18:44:58 +0200 Subject: cmGlobalGenerator: Return from Compute whether to generate. --- Source/cmGlobalGenerator.cxx | 11 ++++++----- Source/cmGlobalGenerator.h | 2 +- Source/cmake.cxx | 5 ++++- 3 files changed, 11 insertions(+), 7 deletions(-) diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx index 390d6b4..65d74bd 100644 --- a/Source/cmGlobalGenerator.cxx +++ b/Source/cmGlobalGenerator.cxx @@ -1212,7 +1212,7 @@ bool cmGlobalGenerator::CheckALLOW_DUPLICATE_CUSTOM_TARGETS() const return false; } -void cmGlobalGenerator::Compute() +bool cmGlobalGenerator::Compute() { // Some generators track files replaced during the Generate. // Start with an empty vector: @@ -1220,16 +1220,17 @@ void cmGlobalGenerator::Compute() // clear targets to issue warning CMP0042 for this->CMP0042WarnTargets.clear(); -} -void cmGlobalGenerator::Generate() -{ // Check whether this generator is allowed to run. if(!this->CheckALLOW_DUPLICATE_CUSTOM_TARGETS()) { - return; + return false; } + return true; +} +void cmGlobalGenerator::Generate() +{ this->FinalizeTargetCompileInfo(); this->CreateGenerationObjects(); diff --git a/Source/cmGlobalGenerator.h b/Source/cmGlobalGenerator.h index 9c36cca..7bf6b24 100644 --- a/Source/cmGlobalGenerator.h +++ b/Source/cmGlobalGenerator.h @@ -86,7 +86,7 @@ public: */ virtual void Configure(); - void Compute(); + bool Compute(); enum TargetTypes { AllTargets, diff --git a/Source/cmake.cxx b/Source/cmake.cxx index 619374e..ec8276e 100644 --- a/Source/cmake.cxx +++ b/Source/cmake.cxx @@ -1607,7 +1607,10 @@ int cmake::Generate() { return -1; } - this->GlobalGenerator->Compute(); + if (!this->GlobalGenerator->Compute()) + { + return -1; + } this->GlobalGenerator->Generate(); if ( !this->GraphVizFile.empty() ) { -- cgit v0.12 From 2e94cba3565105aaa23720d9ffdcb9fe1ccee6b9 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Tue, 28 Jul 2015 18:56:59 +0200 Subject: cmGlobalGenerator: Move FinalizeTargetCompileInfo to Compute(). --- Source/cmGlobalGenerator.cxx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx index 65d74bd..dcbc558 100644 --- a/Source/cmGlobalGenerator.cxx +++ b/Source/cmGlobalGenerator.cxx @@ -1226,13 +1226,13 @@ bool cmGlobalGenerator::Compute() { return false; } + this->FinalizeTargetCompileInfo(); + return true; } void cmGlobalGenerator::Generate() { - this->FinalizeTargetCompileInfo(); - this->CreateGenerationObjects(); #ifdef CMAKE_BUILD_WITH_CMAKE -- cgit v0.12 From 610572b7d27e122ebf8e5c5d430019844567a996 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Tue, 28 Jul 2015 18:31:23 +0200 Subject: cmMakefile: Simplify generate-time cmGeneratorTarget creation. --- Source/cmMakefile.cxx | 1 + Source/cmQtAutoGenerators.cxx | 1 - 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index 20c56ba..4bdc9d5 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -1909,6 +1909,7 @@ const char* cmMakefile::GetCurrentBinaryDirectory() const void cmMakefile::AddGeneratorTarget(cmTarget* t, cmGeneratorTarget* gt) { this->GeneratorTargets[t] = gt; + this->GetGlobalGenerator()->AddGeneratorTarget(t, gt); } //---------------------------------------------------------------------------- diff --git a/Source/cmQtAutoGenerators.cxx b/Source/cmQtAutoGenerators.cxx index 979db91..1322dea 100644 --- a/Source/cmQtAutoGenerators.cxx +++ b/Source/cmQtAutoGenerators.cxx @@ -476,7 +476,6 @@ bool cmQtAutoGenerators::InitializeAutogenTarget(cmLocalGenerator* lg, commandLines, false, autogenComment.c_str()); cmGeneratorTarget* gt = new cmGeneratorTarget(autogenTarget, lg); - lg->GetGlobalGenerator()->AddGeneratorTarget(autogenTarget, gt); makefile->AddGeneratorTarget(autogenTarget, gt); // Set target folder -- cgit v0.12 From aa2407d84d8bcd983b3df294032831bbd54cf25d Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Tue, 28 Jul 2015 18:32:40 +0200 Subject: Xcode: Use allBuild target return value. --- Source/cmGlobalXCodeGenerator.cxx | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx index d6f5a00..91b8186 100644 --- a/Source/cmGlobalXCodeGenerator.cxx +++ b/Source/cmGlobalXCodeGenerator.cxx @@ -449,10 +449,9 @@ cmGlobalXCodeGenerator::AddExtraTargets(cmLocalGenerator* root, // Add ALL_BUILD const char* no_working_directory = 0; std::vector no_depends; - mf->AddUtilityCommand("ALL_BUILD", true, no_depends, + cmTarget* allbuild = mf->AddUtilityCommand("ALL_BUILD", true, no_depends, no_working_directory, "echo", "Build all projects"); - cmTarget* allbuild = mf->FindTarget("ALL_BUILD"); // Refer to the main build configuration file for easy editing. std::string listfile = mf->GetCurrentSourceDirectory(); -- cgit v0.12 From ff1019bfac1380681989242fa904c2d9fe13fd38 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Tue, 28 Jul 2015 18:57:29 +0200 Subject: cmGlobalGenerator: Move generation object creation to Compute(). --- Source/cmGlobalGenerator.cxx | 4 ++-- Source/cmGlobalVisualStudio8Generator.cxx | 2 ++ Source/cmGlobalVisualStudioGenerator.cxx | 2 ++ Source/cmGlobalXCodeGenerator.cxx | 7 ++++++- 4 files changed, 12 insertions(+), 3 deletions(-) diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx index dcbc558..b79576c 100644 --- a/Source/cmGlobalGenerator.cxx +++ b/Source/cmGlobalGenerator.cxx @@ -1228,13 +1228,13 @@ bool cmGlobalGenerator::Compute() } this->FinalizeTargetCompileInfo(); + this->CreateGenerationObjects(); + return true; } void cmGlobalGenerator::Generate() { - this->CreateGenerationObjects(); - #ifdef CMAKE_BUILD_WITH_CMAKE // Iterate through all targets and set up automoc for those which have // the AUTOMOC, AUTOUIC or AUTORCC property set diff --git a/Source/cmGlobalVisualStudio8Generator.cxx b/Source/cmGlobalVisualStudio8Generator.cxx index f3cf36e..16e3f9b 100644 --- a/Source/cmGlobalVisualStudio8Generator.cxx +++ b/Source/cmGlobalVisualStudio8Generator.cxx @@ -254,6 +254,8 @@ bool cmGlobalVisualStudio8Generator::AddCheckTarget() mf->AddUtilityCommand(CMAKE_CHECK_BUILD_SYSTEM_TARGET, false, no_working_directory, no_depends, noCommandLines); + cmGeneratorTarget* gt = new cmGeneratorTarget(tgt, lg); + mf->AddGeneratorTarget(tgt, gt); // Organize in the "predefined targets" folder: // diff --git a/Source/cmGlobalVisualStudioGenerator.cxx b/Source/cmGlobalVisualStudioGenerator.cxx index d6973aa..a147eb3 100644 --- a/Source/cmGlobalVisualStudioGenerator.cxx +++ b/Source/cmGlobalVisualStudioGenerator.cxx @@ -85,6 +85,8 @@ void cmGlobalVisualStudioGenerator::Generate() AddUtilityCommand("ALL_BUILD", true, no_working_dir, no_depends, no_commands, false, "Build all projects"); + cmGeneratorTarget* gt = new cmGeneratorTarget(allBuild, gen[0]); + allBuild->GetMakefile()->AddGeneratorTarget(allBuild, gt); #if 0 // Can't activate this code because we want ALL_BUILD diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx index 91b8186..ffa4c5d 100644 --- a/Source/cmGlobalXCodeGenerator.cxx +++ b/Source/cmGlobalXCodeGenerator.cxx @@ -452,6 +452,8 @@ cmGlobalXCodeGenerator::AddExtraTargets(cmLocalGenerator* root, cmTarget* allbuild = mf->AddUtilityCommand("ALL_BUILD", true, no_depends, no_working_directory, "echo", "Build all projects"); + cmGeneratorTarget* allBuildGt = new cmGeneratorTarget(allbuild, root); + mf->AddGeneratorTarget(allbuild, allBuildGt); // Refer to the main build configuration file for easy editing. std::string listfile = mf->GetCurrentSourceDirectory(); @@ -480,9 +482,12 @@ cmGlobalXCodeGenerator::AddExtraTargets(cmLocalGenerator* root, std::string file = this->ConvertToRelativeForMake( this->CurrentReRunCMakeMakefile.c_str()); cmSystemTools::ReplaceString(file, "\\ ", " "); - mf->AddUtilityCommand(CMAKE_CHECK_BUILD_SYSTEM_TARGET, true, no_depends, + cmTarget* check = mf->AddUtilityCommand(CMAKE_CHECK_BUILD_SYSTEM_TARGET, + true, no_depends, no_working_directory, "make", "-f", file.c_str()); + cmGeneratorTarget* checkGt = new cmGeneratorTarget(check, root); + mf->AddGeneratorTarget(check, checkGt); } // now make the allbuild depend on all the non-utility targets -- cgit v0.12 From 5edb3354854bd2de4f9ea0e2c4af4069f46a4830 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Sat, 25 Jul 2015 19:03:51 +0200 Subject: cmGlobalGenerator: Virtualize the Compute step and override it. --- Source/cmGlobalGenerator.h | 2 +- Source/cmGlobalVisualStudio10Generator.cxx | 11 ++++++++++- Source/cmGlobalVisualStudio10Generator.h | 2 ++ Source/cmGlobalVisualStudio8Generator.cxx | 11 +++++++---- Source/cmGlobalVisualStudio8Generator.h | 2 +- Source/cmGlobalVisualStudioGenerator.cxx | 11 +++++++---- Source/cmGlobalVisualStudioGenerator.h | 2 +- Source/cmGlobalXCodeGenerator.cxx | 13 ++++++++++++- Source/cmGlobalXCodeGenerator.h | 1 + 9 files changed, 42 insertions(+), 13 deletions(-) diff --git a/Source/cmGlobalGenerator.h b/Source/cmGlobalGenerator.h index 7bf6b24..9492372 100644 --- a/Source/cmGlobalGenerator.h +++ b/Source/cmGlobalGenerator.h @@ -86,7 +86,7 @@ public: */ virtual void Configure(); - bool Compute(); + virtual bool Compute(); enum TargetTypes { AllTargets, diff --git a/Source/cmGlobalVisualStudio10Generator.cxx b/Source/cmGlobalVisualStudio10Generator.cxx index 4e8ada4..8ec4fd9 100644 --- a/Source/cmGlobalVisualStudio10Generator.cxx +++ b/Source/cmGlobalVisualStudio10Generator.cxx @@ -314,9 +314,18 @@ cmGlobalVisualStudio10Generator::CreateLocalGenerator(cmLocalGenerator* parent, } //---------------------------------------------------------------------------- -void cmGlobalVisualStudio10Generator::Generate() +bool cmGlobalVisualStudio10Generator::Compute() { + if (!cmGlobalVisualStudio8Generator::Compute()) + { + return false; + } this->LongestSource = LongestSourcePath(); + return true; +} + +void cmGlobalVisualStudio10Generator::Generate() +{ this->cmGlobalVisualStudio8Generator::Generate(); if(this->LongestSource.Length > 0) { diff --git a/Source/cmGlobalVisualStudio10Generator.h b/Source/cmGlobalVisualStudio10Generator.h index 74d5022..3d34a3f 100644 --- a/Source/cmGlobalVisualStudio10Generator.h +++ b/Source/cmGlobalVisualStudio10Generator.h @@ -45,6 +45,8 @@ public: std::vector const& makeOptions = std::vector() ); + virtual bool Compute(); + ///! create the correct local generator virtual cmLocalGenerator *CreateLocalGenerator(cmLocalGenerator* parent, cmState::Snapshot snapshot); diff --git a/Source/cmGlobalVisualStudio8Generator.cxx b/Source/cmGlobalVisualStudio8Generator.cxx index 16e3f9b..d5a5585 100644 --- a/Source/cmGlobalVisualStudio8Generator.cxx +++ b/Source/cmGlobalVisualStudio8Generator.cxx @@ -347,8 +347,13 @@ bool cmGlobalVisualStudio8Generator::AddCheckTarget() } //---------------------------------------------------------------------------- -void cmGlobalVisualStudio8Generator::Generate() +bool cmGlobalVisualStudio8Generator::Compute() { + if (!cmGlobalVisualStudio7Generator::Compute()) + { + return false; + } + if(this->AddCheckTarget()) { // All targets depend on the build-system check target. @@ -362,9 +367,7 @@ void cmGlobalVisualStudio8Generator::Generate() } } } - - // Now perform the main generation. - this->cmGlobalVisualStudio7Generator::Generate(); + return true; } //---------------------------------------------------------------------------- diff --git a/Source/cmGlobalVisualStudio8Generator.h b/Source/cmGlobalVisualStudio8Generator.h index cc02b78..1c61103 100644 --- a/Source/cmGlobalVisualStudio8Generator.h +++ b/Source/cmGlobalVisualStudio8Generator.h @@ -67,7 +67,7 @@ public: return !this->WindowsCEVersion.empty(); } protected: - virtual void Generate(); + virtual bool Compute(); virtual const char* GetIDEVersion() { return "8.0"; } virtual std::string FindDevEnvCommand(); diff --git a/Source/cmGlobalVisualStudioGenerator.cxx b/Source/cmGlobalVisualStudioGenerator.cxx index a147eb3..2f9d79a 100644 --- a/Source/cmGlobalVisualStudioGenerator.cxx +++ b/Source/cmGlobalVisualStudioGenerator.cxx @@ -64,8 +64,13 @@ std::string cmGlobalVisualStudioGenerator::GetRegistryBase( } //---------------------------------------------------------------------------- -void cmGlobalVisualStudioGenerator::Generate() +bool cmGlobalVisualStudioGenerator::Compute() { + if (!cmGlobalGenerator::Compute()) + { + return false; + } + // Add a special target that depends on ALL projects for easy build // of one configuration only. const char* no_working_dir = 0; @@ -136,9 +141,7 @@ void cmGlobalVisualStudioGenerator::Generate() static_cast(*lgi); lg->AddCMakeListsRules(); } - - // Run all the local generators. - this->cmGlobalGenerator::Generate(); + return true; } //---------------------------------------------------------------------------- diff --git a/Source/cmGlobalVisualStudioGenerator.h b/Source/cmGlobalVisualStudioGenerator.h index 8e2d6a4..64440ad 100644 --- a/Source/cmGlobalVisualStudioGenerator.h +++ b/Source/cmGlobalVisualStudioGenerator.h @@ -108,7 +108,7 @@ public: cmGeneratorTarget*, std::vector& commands, std::string const& configName); protected: - virtual void Generate(); + virtual bool Compute(); // Does this VS version link targets to each other if there are // dependencies in the SLN file? This was done for VS versions diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx index ffa4c5d..7dea107 100644 --- a/Source/cmGlobalXCodeGenerator.cxx +++ b/Source/cmGlobalXCodeGenerator.cxx @@ -378,8 +378,13 @@ cmGlobalXCodeGenerator::CreateLocalGenerator(cmLocalGenerator* parent, } //---------------------------------------------------------------------------- -void cmGlobalXCodeGenerator::Generate() +bool cmGlobalXCodeGenerator::Compute() { + if (!cmGlobalGenerator::Compute()) + { + return false; + } + std::map >::iterator it; // make sure extra targets are added before calling // the parent generate which will call trace depends @@ -390,11 +395,17 @@ void cmGlobalXCodeGenerator::Generate() // add ALL_BUILD, INSTALL, etc this->AddExtraTargets(root, it->second); } + return true; +} + +void cmGlobalXCodeGenerator::Generate() +{ this->cmGlobalGenerator::Generate(); if(cmSystemTools::GetErrorOccuredFlag()) { return; } + std::map >::iterator it; for(it = this->ProjectMap.begin(); it!= this->ProjectMap.end(); ++it) { cmLocalGenerator* root = it->second[0]; diff --git a/Source/cmGlobalXCodeGenerator.h b/Source/cmGlobalXCodeGenerator.h index c36e4af..ee8bf2c 100644 --- a/Source/cmGlobalXCodeGenerator.h +++ b/Source/cmGlobalXCodeGenerator.h @@ -88,6 +88,7 @@ public: virtual bool SetGeneratorToolset(std::string const& ts, cmMakefile* mf); void AppendFlag(std::string& flags, std::string const& flag); protected: + virtual bool Compute(); virtual void Generate(); private: cmXCodeObject* CreateOrGetPBXGroup(cmTarget& cmtarget, -- cgit v0.12 From 0368552d7fcdd35a0cb52043a8567e66d62bccd3 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Tue, 28 Jul 2015 18:58:26 +0200 Subject: cmGlobalGenerator: Move QtAutogen handling to Compute(). --- Source/cmGlobalGenerator.cxx | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx index b79576c..463f526 100644 --- a/Source/cmGlobalGenerator.cxx +++ b/Source/cmGlobalGenerator.cxx @@ -1230,11 +1230,6 @@ bool cmGlobalGenerator::Compute() this->CreateGenerationObjects(); - return true; -} - -void cmGlobalGenerator::Generate() -{ #ifdef CMAKE_BUILD_WITH_CMAKE // Iterate through all targets and set up automoc for those which have // the AUTOMOC, AUTOUIC or AUTORCC property set @@ -1265,6 +1260,13 @@ void cmGlobalGenerator::Generate() } #endif + return true; +} + +void cmGlobalGenerator::Generate() +{ + unsigned int i; + // Trace the dependencies, after that no custom commands should be added // because their dependencies might not be handled correctly for (i = 0; i < this->LocalGenerators.size(); ++i) -- cgit v0.12 From 5f662b3887c3e92adfcad1bc92eabfd86db263b7 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Tue, 28 Jul 2015 18:12:03 +0200 Subject: cmScriptGenerator: Remove unused method. --- Source/cmScriptGenerator.h | 3 --- 1 file changed, 3 deletions(-) diff --git a/Source/cmScriptGenerator.h b/Source/cmScriptGenerator.h index 9ab04f1..bc9372f 100644 --- a/Source/cmScriptGenerator.h +++ b/Source/cmScriptGenerator.h @@ -54,9 +54,6 @@ public: void Generate(std::ostream& os, const std::string& config, std::vector const& configurationTypes); - const std::vector& GetConfigurations() const - { return this->Configurations; } - protected: typedef cmScriptGeneratorIndent Indent; virtual void GenerateScript(std::ostream& os); -- cgit v0.12 From 3ef8aaaa71786b32ed88a29e48dd17d32f5a8a79 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Tue, 28 Jul 2015 22:00:27 +0200 Subject: cmInstallCommand: Move the SetHaveInstallRule invocation. Remove the call from cmInstallTargetGenerator because that is to be ported away from cmTarget. --- Source/cmInstallCommand.cxx | 6 ++++++ Source/cmInstallTargetGenerator.cxx | 1 - 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/Source/cmInstallCommand.cxx b/Source/cmInstallCommand.cxx index 899b088..a33acad 100644 --- a/Source/cmInstallCommand.cxx +++ b/Source/cmInstallCommand.cxx @@ -752,6 +752,12 @@ bool cmInstallCommand::HandleTargetsMode(std::vector const& args) installsPublicHeader = installsPublicHeader || publicHeaderGenerator != 0; installsResource = installsResource || resourceGenerator; + if (installsArchive || installsRuntime || installsFramework + || installsLibrary || installsBundle) + { + target.SetHaveInstallRule(true); + } + this->Makefile->AddInstallGenerator(archiveGenerator); this->Makefile->AddInstallGenerator(libraryGenerator); this->Makefile->AddInstallGenerator(runtimeGenerator); diff --git a/Source/cmInstallTargetGenerator.cxx b/Source/cmInstallTargetGenerator.cxx index 5115788..09af56e 100644 --- a/Source/cmInstallTargetGenerator.cxx +++ b/Source/cmInstallTargetGenerator.cxx @@ -35,7 +35,6 @@ cmInstallTargetGenerator { this->ActionsPerConfig = true; this->NamelinkMode = NamelinkModeNone; - this->Target->SetHaveInstallRule(true); } //---------------------------------------------------------------------------- -- cgit v0.12 From e5e529701812bdfe7ea1c3ffe682bd576b9c05a8 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Tue, 28 Jul 2015 19:49:16 +0200 Subject: cmInstallGenerator: Add a Compute() virtual hook. --- Source/cmGlobalGenerator.cxx | 12 ++++++++++++ Source/cmInstallGenerator.h | 2 ++ 2 files changed, 14 insertions(+) diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx index 463f526..1d6608b 100644 --- a/Source/cmGlobalGenerator.cxx +++ b/Source/cmGlobalGenerator.cxx @@ -34,6 +34,7 @@ #include "cmExportBuildFileGenerator.h" #include "cmCPackPropertiesGenerator.h" #include "cmAlgorithms.h" +#include "cmInstallGenerator.h" #include #include @@ -1260,6 +1261,17 @@ bool cmGlobalGenerator::Compute() } #endif + for (i = 0; i < this->LocalGenerators.size(); ++i) + { + cmMakefile* mf = this->LocalGenerators[i]->GetMakefile(); + std::vector& gens = mf->GetInstallGenerators(); + for (std::vector::const_iterator git = gens.begin(); + git != gens.end(); ++git) + { + (*git)->Compute(this->LocalGenerators[i]); + } + } + return true; } diff --git a/Source/cmInstallGenerator.h b/Source/cmInstallGenerator.h index c4191e4..b8e5b53 100644 --- a/Source/cmInstallGenerator.h +++ b/Source/cmInstallGenerator.h @@ -62,6 +62,8 @@ public: /** Select message level from CMAKE_INSTALL_MESSAGE or 'never'. */ static MessageLevel SelectMessageLevel(cmMakefile* mf, bool never = false); + virtual void Compute(cmLocalGenerator*) {} + protected: virtual void GenerateScript(std::ostream& os); -- cgit v0.12 From 4e41913f9acb6a33f6a4eb1b88577fb7499e99d6 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Tue, 28 Jul 2015 19:32:03 +0200 Subject: cmInstallCommand: Store only a targetName, not a cmTarget. Compute the cmTarget at Compute() time. --- Source/cmInstallCommand.cxx | 3 ++- Source/cmInstallTargetGenerator.cxx | 12 ++++++++++-- Source/cmInstallTargetGenerator.h | 6 +++++- Source/cmLocalGenerator.cxx | 18 +++++++++++------- 4 files changed, 28 insertions(+), 11 deletions(-) diff --git a/Source/cmInstallCommand.cxx b/Source/cmInstallCommand.cxx index a33acad..f548f5d 100644 --- a/Source/cmInstallCommand.cxx +++ b/Source/cmInstallCommand.cxx @@ -27,7 +27,8 @@ static cmInstallTargetGenerator* CreateInstallTargetGenerator(cmTarget& target, { cmInstallGenerator::MessageLevel message = cmInstallGenerator::SelectMessageLevel(target.GetMakefile()); - return new cmInstallTargetGenerator(target, args.GetDestination().c_str(), + return new cmInstallTargetGenerator(target.GetName(), + args.GetDestination().c_str(), impLib, args.GetPermissions().c_str(), args.GetConfigurations(), args.GetComponent().c_str(), message, diff --git a/Source/cmInstallTargetGenerator.cxx b/Source/cmInstallTargetGenerator.cxx index 09af56e..a5d8a74 100644 --- a/Source/cmInstallTargetGenerator.cxx +++ b/Source/cmInstallTargetGenerator.cxx @@ -22,13 +22,16 @@ //---------------------------------------------------------------------------- cmInstallTargetGenerator -::cmInstallTargetGenerator(cmTarget& t, const char* dest, bool implib, +::cmInstallTargetGenerator(const std::string& targetName, + const char* dest, bool implib, const char* file_permissions, std::vector const& configurations, const char* component, MessageLevel message, bool optional): - cmInstallGenerator(dest, configurations, component, message), Target(&t), + cmInstallGenerator(dest, configurations, component, message), + TargetName(targetName), + Target(0), FilePermissions(file_permissions), ImportLibrary(implib), Optional(optional) @@ -430,6 +433,11 @@ cmInstallTargetGenerator::GetInstallFilename(cmTarget const* target, return fname; } +void cmInstallTargetGenerator::Compute(cmLocalGenerator* lg) +{ + this->Target = lg->GetMakefile()->FindTarget(this->TargetName); +} + //---------------------------------------------------------------------------- void cmInstallTargetGenerator diff --git a/Source/cmInstallTargetGenerator.h b/Source/cmInstallTargetGenerator.h index db69220..128e1a2 100644 --- a/Source/cmInstallTargetGenerator.h +++ b/Source/cmInstallTargetGenerator.h @@ -22,7 +22,7 @@ class cmInstallTargetGenerator: public cmInstallGenerator { public: cmInstallTargetGenerator( - cmTarget& t, const char* dest, bool implib, + std::string const& targetName, const char* dest, bool implib, const char* file_permissions, std::vector const& configurations, const char* component, @@ -56,7 +56,10 @@ public: const std::string& config, NameType nameType = NameNormal); + void Compute(cmLocalGenerator* lg); + cmTarget* GetTarget() const { return this->Target; } + bool IsImportLibrary() const { return this->ImportLibrary; } std::string GetDestination(std::string const& config) const; @@ -98,6 +101,7 @@ protected: void AddRanlibRule(std::ostream& os, Indent const& indent, const std::string& toDestDirPath); + std::string TargetName; cmTarget* Target; std::string FilePermissions; NamelinkModeType NamelinkMode; diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx index 2e20ee2..6b48a44 100644 --- a/Source/cmLocalGenerator.cxx +++ b/Source/cmLocalGenerator.cxx @@ -2375,11 +2375,15 @@ cmLocalGenerator::ConstructComment(cmCustomCommandGenerator const& ccg, class cmInstallTargetGeneratorLocal: public cmInstallTargetGenerator { public: - cmInstallTargetGeneratorLocal(cmTarget& t, const char* dest, bool implib): + cmInstallTargetGeneratorLocal(cmLocalGenerator* lg, std::string const& t, + const char* dest, bool implib): cmInstallTargetGenerator( t, dest, implib, "", std::vector(), "Unspecified", - cmInstallGenerator::SelectMessageLevel(t.GetMakefile()), - false) {} + cmInstallGenerator::SelectMessageLevel(lg->GetMakefile()), + false) + { + this->Compute(lg); + } }; //---------------------------------------------------------------------------- @@ -2428,7 +2432,7 @@ cmLocalGenerator { // Use a target install generator. cmInstallTargetGeneratorLocal - g(l->second, destination.c_str(), false); + g(this, l->first, destination.c_str(), false); g.Generate(os, config, configurationTypes); } break; @@ -2439,18 +2443,18 @@ cmLocalGenerator // to the normal destination and the DLL to the runtime // destination. cmInstallTargetGeneratorLocal - g1(l->second, destination.c_str(), true); + g1(this, l->first, destination.c_str(), true); g1.Generate(os, config, configurationTypes); // We also skip over the leading slash given by the user. destination = l->second.GetRuntimeInstallPath().substr(1); cmSystemTools::ConvertToUnixSlashes(destination); cmInstallTargetGeneratorLocal - g2(l->second, destination.c_str(), false); + g2(this, l->first, destination.c_str(), false); g2.Generate(os, config, configurationTypes); #else // Use a target install generator. cmInstallTargetGeneratorLocal - g(l->second, destination.c_str(), false); + g(this, l->first, destination.c_str(), false); g.Generate(os, config, configurationTypes); #endif } -- cgit v0.12 From a23fcc9558f9f2788fc828f7473060ea1f035f55 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Tue, 28 Jul 2015 19:58:52 +0200 Subject: cmInstallTargetGenerator: Port to cmGeneratorTarget. --- Source/cmExportInstallFileGenerator.cxx | 2 +- Source/cmInstallTargetGenerator.cxx | 78 +++++++++++++++++++-------------- Source/cmInstallTargetGenerator.h | 8 ++-- 3 files changed, 50 insertions(+), 38 deletions(-) diff --git a/Source/cmExportInstallFileGenerator.cxx b/Source/cmExportInstallFileGenerator.cxx index 6c7d97e..1d75f43 100644 --- a/Source/cmExportInstallFileGenerator.cxx +++ b/Source/cmExportInstallFileGenerator.cxx @@ -398,7 +398,7 @@ cmExportInstallFileGenerator } // Get the target to be installed. - cmTarget* target = itgen->GetTarget(); + cmTarget* target = itgen->GetTarget()->Target; // Construct the installed location of the target. std::string dest = itgen->GetDestination(config); diff --git a/Source/cmInstallTargetGenerator.cxx b/Source/cmInstallTargetGenerator.cxx index a5d8a74..01d4b77 100644 --- a/Source/cmInstallTargetGenerator.cxx +++ b/Source/cmInstallTargetGenerator.cxx @@ -16,6 +16,7 @@ #include "cmGlobalGenerator.h" #include "cmLocalGenerator.h" #include "cmMakefile.h" +#include "cmGeneratorTarget.h" #include "cmake.h" #include @@ -71,15 +72,17 @@ void cmInstallTargetGenerator::GenerateScriptForConfig(std::ostream& os, { // Compute the build tree directory from which to copy the target. std::string fromDirConfig; - if(this->Target->NeedRelinkBeforeInstall(config)) + if(this->Target->Target->NeedRelinkBeforeInstall(config)) { - fromDirConfig = this->Target->GetMakefile()->GetCurrentBinaryDirectory(); + fromDirConfig = + this->Target->Target->GetMakefile()->GetCurrentBinaryDirectory(); fromDirConfig += cmake::GetCMakeFilesDirectory(); fromDirConfig += "/CMakeRelink.dir/"; } else { - fromDirConfig = this->Target->GetDirectory(config, this->ImportLibrary); + fromDirConfig = + this->Target->Target->GetDirectory(config, this->ImportLibrary); fromDirConfig += "/"; } std::string toDir = @@ -90,7 +93,8 @@ void cmInstallTargetGenerator::GenerateScriptForConfig(std::ostream& os, std::vector filesFrom; std::vector filesTo; std::string literal_args; - cmTarget::TargetType targetType = this->Target->GetType(); + cmTarget::TargetType targetType = + static_cast(this->Target->GetType()); cmInstallType type = cmInstallType(); switch(targetType) { @@ -107,7 +111,7 @@ void cmInstallTargetGenerator::GenerateScriptForConfig(std::ostream& os, case cmTarget::UTILITY: case cmTarget::GLOBAL_TARGET: case cmTarget::UNKNOWN_LIBRARY: - this->Target->GetMakefile()->IssueMessage(cmake::INTERNAL_ERROR, + this->Target->Target->GetMakefile()->IssueMessage(cmake::INTERNAL_ERROR, "cmInstallTargetGenerator created with non-installable target."); return; } @@ -120,7 +124,7 @@ void cmInstallTargetGenerator::GenerateScriptForConfig(std::ostream& os, std::string targetNameReal; std::string targetNameImport; std::string targetNamePDB; - this->Target->GetExecutableNames(targetName, targetNameReal, + this->Target->Target->GetExecutableNames(targetName, targetNameReal, targetNameImport, targetNamePDB, config); if(this->ImportLibrary) @@ -130,7 +134,7 @@ void cmInstallTargetGenerator::GenerateScriptForConfig(std::ostream& os, filesFrom.push_back(from1); filesTo.push_back(to1); std::string targetNameImportLib; - if(this->Target->GetImplibGNUtoMS(targetNameImport, + if(this->Target->Target->GetImplibGNUtoMS(targetNameImport, targetNameImportLib)) { filesFrom.push_back(fromDirConfig + targetNameImportLib); @@ -146,7 +150,7 @@ void cmInstallTargetGenerator::GenerateScriptForConfig(std::ostream& os, std::string to1 = toDir + targetName; // Handle OSX Bundles. - if(this->Target->IsAppBundleOnApple()) + if(this->Target->Target->IsAppBundleOnApple()) { // Install the whole app bundle directory. type = cmInstallType_DIRECTORY; @@ -180,7 +184,8 @@ void cmInstallTargetGenerator::GenerateScriptForConfig(std::ostream& os, std::string targetNameReal; std::string targetNameImport; std::string targetNamePDB; - this->Target->GetLibraryNames(targetName, targetNameSO, targetNameReal, + this->Target->Target->GetLibraryNames(targetName, targetNameSO, + targetNameReal, targetNameImport, targetNamePDB, config); if(this->ImportLibrary) @@ -193,7 +198,7 @@ void cmInstallTargetGenerator::GenerateScriptForConfig(std::ostream& os, filesFrom.push_back(from1); filesTo.push_back(to1); std::string targetNameImportLib; - if(this->Target->GetImplibGNUtoMS(targetNameImport, + if(this->Target->Target->GetImplibGNUtoMS(targetNameImport, targetNameImportLib)) { filesFrom.push_back(fromDirConfig + targetNameImportLib); @@ -203,7 +208,7 @@ void cmInstallTargetGenerator::GenerateScriptForConfig(std::ostream& os, // An import library looks like a static library. type = cmInstallType_STATIC_LIBRARY; } - else if(this->Target->IsFrameworkOnApple()) + else if(this->Target->Target->IsFrameworkOnApple()) { // There is a bug in cmInstallCommand if this fails. assert(this->NamelinkMode == NamelinkModeNone); @@ -221,7 +226,7 @@ void cmInstallTargetGenerator::GenerateScriptForConfig(std::ostream& os, filesFrom.push_back(from1); filesTo.push_back(to1); } - else if(this->Target->IsCFBundleOnApple()) + else if(this->Target->Target->IsCFBundleOnApple()) { // Install the whole app bundle directory. type = cmInstallType_DIRECTORY; @@ -345,7 +350,7 @@ cmInstallTargetGenerator::GetDestination(std::string const& config) const { cmGeneratorExpression ge; return ge.Parse(this->Destination) - ->Evaluate(this->Target->GetMakefile(), config); + ->Evaluate(this->Target->Target->GetMakefile(), config); } //---------------------------------------------------------------------------- @@ -354,7 +359,7 @@ cmInstallTargetGenerator::GetInstallFilename(const std::string& config) const { NameType nameType = this->ImportLibrary? NameImplib : NameNormal; return - cmInstallTargetGenerator::GetInstallFilename(this->Target, config, + cmInstallTargetGenerator::GetInstallFilename(this->Target->Target, config, nameType); } @@ -435,7 +440,8 @@ cmInstallTargetGenerator::GetInstallFilename(cmTarget const* target, void cmInstallTargetGenerator::Compute(cmLocalGenerator* lg) { - this->Target = lg->GetMakefile()->FindTarget(this->TargetName); + this->Target = lg->GetGlobalGenerator()->GetGeneratorTarget( + lg->GetMakefile()->FindTarget(this->TargetName)); } //---------------------------------------------------------------------------- @@ -540,8 +546,8 @@ cmInstallTargetGenerator } // Fix the install_name settings in installed binaries. - std::string installNameTool = - this->Target->GetMakefile()->GetSafeDefinition("CMAKE_INSTALL_NAME_TOOL"); + std::string installNameTool = this->Target->Target->GetMakefile() + ->GetSafeDefinition("CMAKE_INSTALL_NAME_TOOL"); if(installNameTool.empty()) { @@ -551,7 +557,8 @@ cmInstallTargetGenerator // Build a map of build-tree install_name to install-tree install_name for // shared libraries linked to this target. std::map install_name_remap; - if(cmComputeLinkInformation* cli = this->Target->GetLinkInformation(config)) + if(cmComputeLinkInformation* cli = + this->Target->Target->GetLinkInformation(config)) { std::set const& sharedLibs = cli->GetSharedLibrariesLinked(); @@ -595,11 +602,11 @@ cmInstallTargetGenerator if(this->Target->GetType() == cmTarget::SHARED_LIBRARY) { std::string for_build = - this->Target->GetInstallNameDirForBuildTree(config); + this->Target->Target->GetInstallNameDirForBuildTree(config); std::string for_install = - this->Target->GetInstallNameDirForInstallTree(); + this->Target->Target->GetInstallNameDirForInstallTree(); - if(this->Target->IsFrameworkOnApple() && for_install.empty()) + if(this->Target->Target->IsFrameworkOnApple() && for_install.empty()) { // Frameworks seem to have an id corresponding to their own full // path. @@ -613,7 +620,7 @@ cmInstallTargetGenerator { // Prepare to refer to the install-tree install_name. new_id = for_install; - new_id += this->GetInstallFilename(this->Target, config, NameSO); + new_id += this->GetInstallFilename(this->Target->Target, config, NameSO); } } @@ -646,20 +653,22 @@ cmInstallTargetGenerator std::string const& toDestDirPath) { // Skip the chrpath if the target does not need it. - if(this->ImportLibrary || !this->Target->IsChrpathUsed(config)) + if(this->ImportLibrary || !this->Target->Target->IsChrpathUsed(config)) { return; } // Skip if on Apple - if(this->Target->GetMakefile()->IsOn("CMAKE_PLATFORM_HAS_INSTALLNAME")) + if(this->Target->Target->GetMakefile() + ->IsOn("CMAKE_PLATFORM_HAS_INSTALLNAME")) { return; } // Get the link information for this target. // It can provide the RPATH. - cmComputeLinkInformation* cli = this->Target->GetLinkInformation(config); + cmComputeLinkInformation* cli = + this->Target->Target->GetLinkInformation(config); if(!cli) { return; @@ -684,20 +693,21 @@ cmInstallTargetGenerator std::string const& toDestDirPath) { // Skip the chrpath if the target does not need it. - if(this->ImportLibrary || !this->Target->IsChrpathUsed(config)) + if(this->ImportLibrary || !this->Target->Target->IsChrpathUsed(config)) { return; } // Get the link information for this target. // It can provide the RPATH. - cmComputeLinkInformation* cli = this->Target->GetLinkInformation(config); + cmComputeLinkInformation* cli = + this->Target->Target->GetLinkInformation(config); if(!cli) { return; } - cmMakefile* mf = this->Target->GetMakefile(); + cmMakefile* mf = this->Target->Target->GetMakefile(); if(mf->IsOn("CMAKE_PLATFORM_HAS_INSTALLNAME")) { @@ -809,20 +819,20 @@ cmInstallTargetGenerator::AddStripRule(std::ostream& os, } // Don't handle OSX Bundles. - if(this->Target->GetMakefile()->IsOn("APPLE") && - this->Target->GetPropertyAsBool("MACOSX_BUNDLE")) + if(this->Target->Target->GetMakefile()->IsOn("APPLE") && + this->Target->Target->GetPropertyAsBool("MACOSX_BUNDLE")) { return; } - if(! this->Target->GetMakefile()->IsSet("CMAKE_STRIP")) + if(! this->Target->Target->GetMakefile()->IsSet("CMAKE_STRIP")) { return; } os << indent << "if(CMAKE_INSTALL_DO_STRIP)\n"; os << indent << " execute_process(COMMAND \"" - << this->Target->GetMakefile()->GetDefinition("CMAKE_STRIP") + << this->Target->Target->GetMakefile()->GetDefinition("CMAKE_STRIP") << "\" \"" << toDestDirPath << "\")\n"; os << indent << "endif()\n"; } @@ -841,13 +851,13 @@ cmInstallTargetGenerator::AddRanlibRule(std::ostream& os, // Perform post-installation processing on the file depending // on its type. - if(!this->Target->GetMakefile()->IsOn("APPLE")) + if(!this->Target->Target->GetMakefile()->IsOn("APPLE")) { return; } std::string ranlib = - this->Target->GetMakefile()->GetRequiredDefinition("CMAKE_RANLIB"); + this->Target->Target->GetMakefile()->GetRequiredDefinition("CMAKE_RANLIB"); if(ranlib.empty()) { return; diff --git a/Source/cmInstallTargetGenerator.h b/Source/cmInstallTargetGenerator.h index 128e1a2..a8f4a75 100644 --- a/Source/cmInstallTargetGenerator.h +++ b/Source/cmInstallTargetGenerator.h @@ -13,7 +13,9 @@ #define cmInstallTargetGenerator_h #include "cmInstallGenerator.h" -#include "cmTarget.h" + +class cmTarget; +class cmGeneratorTarget; /** \class cmInstallTargetGenerator * \brief Generate target installation rules. @@ -58,7 +60,7 @@ public: void Compute(cmLocalGenerator* lg); - cmTarget* GetTarget() const { return this->Target; } + cmGeneratorTarget* GetTarget() const { return this->Target; } bool IsImportLibrary() const { return this->ImportLibrary; } @@ -102,7 +104,7 @@ protected: const std::string& toDestDirPath); std::string TargetName; - cmTarget* Target; + cmGeneratorTarget* Target; std::string FilePermissions; NamelinkModeType NamelinkMode; bool ImportLibrary; -- cgit v0.12