summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2006-04-04 15:48:19 (GMT)
committerBrad King <brad.king@kitware.com>2006-04-04 15:48:19 (GMT)
commit2301a025ea1ed9a61cf0028f88b32f726162fbf7 (patch)
tree2e9f8ba74c01e98c9b22c846edc34a06865b6ae8
parentcddedaa7d85c1a4ccc3502a6ec56f6e6cdea6f90 (diff)
downloadCMake-2301a025ea1ed9a61cf0028f88b32f726162fbf7.zip
CMake-2301a025ea1ed9a61cf0028f88b32f726162fbf7.tar.gz
CMake-2301a025ea1ed9a61cf0028f88b32f726162fbf7.tar.bz2
ENH: Added global TargetManifest computation between Configure and Generate steps. This allows generators to know what other targets will exist on disk when the build completes.
-rw-r--r--Source/cmGlobalGenerator.cxx13
-rw-r--r--Source/cmGlobalGenerator.h8
-rw-r--r--Source/cmLocalGenerator.cxx57
-rw-r--r--Source/cmLocalGenerator.h7
-rw-r--r--Source/cmTarget.h3
5 files changed, 85 insertions, 3 deletions
diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx
index 6b64277..9e9bbe4 100644
--- a/Source/cmGlobalGenerator.cxx
+++ b/Source/cmGlobalGenerator.cxx
@@ -701,8 +701,6 @@ void cmGlobalGenerator::Generate()
}
}
}
-
- // Generate project files
for (i = 0; i < this->LocalGenerators.size(); ++i)
{
cmTargets* targets = &(this->LocalGenerators[i]->GetMakefile()->GetTargets());
@@ -711,6 +709,17 @@ void cmGlobalGenerator::Generate()
{
(*targets)[tit->first] = tit->second;
}
+ }
+
+ // Compute the manifest of main targets generated.
+ for (i = 0; i < this->LocalGenerators.size(); ++i)
+ {
+ this->LocalGenerators[i]->GenerateTargetManifest(this->TargetManifest);
+ }
+
+ // Generate project files
+ for (i = 0; i < this->LocalGenerators.size(); ++i)
+ {
this->LocalGenerators[i]->Generate();
this->LocalGenerators[i]->GenerateInstallRules();
this->LocalGenerators[i]->GenerateTestFiles();
diff --git a/Source/cmGlobalGenerator.h b/Source/cmGlobalGenerator.h
index c5a5f78..3911d9e 100644
--- a/Source/cmGlobalGenerator.h
+++ b/Source/cmGlobalGenerator.h
@@ -171,6 +171,10 @@ public:
const char* 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() { return this->TargetManifest; }
+
protected:
// Fill the ProjectMap, this must be called after LocalGenerators
// has been populated.
@@ -205,6 +209,10 @@ protected:
// Set of named installation components requested by the project.
std::set<cmStdString> InstallComponents;
+ // Manifest of all targets that will be built for each configuration.
+ // This is computed just before local generators generate.
+ cmTargetManifest TargetManifest;
+
private:
// If you add a new map here, make sure it is copied
// in EnableLanguagesFromGenerator
diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx
index 748bfe5..9d65c2b 100644
--- a/Source/cmLocalGenerator.cxx
+++ b/Source/cmLocalGenerator.cxx
@@ -391,6 +391,63 @@ void cmLocalGenerator::GenerateInstallRules()
}
}
+//----------------------------------------------------------------------------
+void cmLocalGenerator::GenerateTargetManifest(cmTargetManifest& manifest)
+{
+ // Collect the set of configuration types.
+ std::vector<std::string> configNames;
+ if(const char* configurationTypes =
+ this->Makefile->GetDefinition("CMAKE_CONFIGURATION_TYPES"))
+ {
+ cmSystemTools::ExpandListArgument(configurationTypes, configNames);
+ }
+ else if(const char* buildType =
+ this->Makefile->GetDefinition("CMAKE_BUILD_TYPE"))
+ {
+ if(*buildType)
+ {
+ configNames.push_back(buildType);
+ }
+ }
+
+ // Add our targets to the manifest for each configuration.
+ cmTargets& targets = this->Makefile->GetTargets();
+ for(cmTargets::iterator t = targets.begin(); t != targets.end(); ++t)
+ {
+ cmTarget& target = t->second;
+ cmTarget::TargetType type = target.GetType();
+ if(type == cmTarget::STATIC_LIBRARY ||
+ type == cmTarget::SHARED_LIBRARY ||
+ type == cmTarget::MODULE_LIBRARY ||
+ type == cmTarget::EXECUTABLE)
+ {
+ if(configNames.empty())
+ {
+ manifest[""].insert(target.GetFullPath(0, false));
+ if(type == cmTarget::SHARED_LIBRARY &&
+ this->Makefile->GetDefinition("CMAKE_IMPORT_LIBRARY_SUFFIX"))
+ {
+ manifest[""].insert(target.GetFullPath(0, true));
+ }
+ }
+ else
+ {
+ for(std::vector<std::string>::iterator ci = configNames.begin();
+ ci != configNames.end(); ++ci)
+ {
+ const char* config = ci->c_str();
+ manifest[config].insert(target.GetFullPath(config, false));
+ if(type == cmTarget::SHARED_LIBRARY &&
+ this->Makefile->GetDefinition("CMAKE_IMPORT_LIBRARY_SUFFIX"))
+ {
+ manifest[config].insert(target.GetFullPath(config, true));
+ }
+ }
+ }
+ }
+ }
+}
+
void cmLocalGenerator::AddCustomCommandToCreateObject(const char* ofname,
const char* lang,
cmSourceFile& source,
diff --git a/Source/cmLocalGenerator.h b/Source/cmLocalGenerator.h
index 9a1df74..a7e0740 100644
--- a/Source/cmLocalGenerator.h
+++ b/Source/cmLocalGenerator.h
@@ -22,6 +22,7 @@
class cmMakefile;
class cmGlobalGenerator;
class cmTarget;
+class cmTargetManifest;
class cmSourceFile;
@@ -63,7 +64,11 @@ public:
* Generate the test files for tests.
*/
virtual void GenerateTestFiles();
-
+
+ /**
+ * Generate a manifest of target files that will be built.
+ */
+ virtual void GenerateTargetManifest(cmTargetManifest&);
///! Get the makefile for this generator
cmMakefile *GetMakefile() {
diff --git a/Source/cmTarget.h b/Source/cmTarget.h
index 067619a..736bad5 100644
--- a/Source/cmTarget.h
+++ b/Source/cmTarget.h
@@ -346,4 +346,7 @@ private:
typedef std::map<cmStdString,cmTarget> cmTargets;
+class cmTargetSet: public std::set<cmStdString> {};
+class cmTargetManifest: public std::map<cmStdString, cmTargetSet> {};
+
#endif