summaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
authorBill Hoffman <bill.hoffman@kitware.com>2006-11-09 14:57:23 (GMT)
committerBill Hoffman <bill.hoffman@kitware.com>2006-11-09 14:57:23 (GMT)
commitb0bc59f70988d169dd0c00ccecc19e42548fcd9f (patch)
tree8bdfad578d85761e0314e1cd4cc12fe96015adb0 /Source
parent976424f8d3aec590364e935d5b61905c7c91db83 (diff)
downloadCMake-b0bc59f70988d169dd0c00ccecc19e42548fcd9f.zip
CMake-b0bc59f70988d169dd0c00ccecc19e42548fcd9f.tar.gz
CMake-b0bc59f70988d169dd0c00ccecc19e42548fcd9f.tar.bz2
ENH: commit fix for putting everything in the build on vs
Diffstat (limited to 'Source')
-rw-r--r--Source/cmGlobalGenerator.cxx23
-rw-r--r--Source/cmGlobalGenerator.h3
-rw-r--r--Source/cmGlobalVisualStudio71Generator.cxx13
-rw-r--r--Source/cmGlobalVisualStudio71Generator.h2
-rw-r--r--Source/cmGlobalVisualStudio7Generator.cxx35
-rw-r--r--Source/cmGlobalVisualStudio7Generator.h4
-rw-r--r--Source/cmGlobalVisualStudio8Generator.cxx4
-rw-r--r--Source/cmGlobalVisualStudio8Generator.h2
-rw-r--r--Source/cmSetTargetPropertiesCommand.h4
9 files changed, 75 insertions, 15 deletions
diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx
index cd54591..130005f 100644
--- a/Source/cmGlobalGenerator.cxx
+++ b/Source/cmGlobalGenerator.cxx
@@ -591,6 +591,29 @@ void cmGlobalGenerator::ClearEnabledLanguages()
this->LanguageEnabled.clear();
}
+bool cmGlobalGenerator::IsDependedOn(const char* project,
+ cmTarget* targetIn)
+{
+ // Get all local gens for this project
+ std::vector<cmLocalGenerator*>* gens = &this->ProjectMap[project];
+ // loop over local gens and get the targets for each one
+ for(unsigned int i = 0; i < gens->size(); ++i)
+ {
+ cmTargets& targets = (*gens)[i]->GetMakefile()->GetTargets();
+ for (cmTargets::iterator l = targets.begin();
+ l != targets.end(); l++)
+ {
+ cmTarget& target = l->second;
+ if(target.GetUtilities().find(targetIn->GetName()) !=
+ target.GetUtilities().end())
+ {
+ return true;
+ }
+ }
+ }
+ return false;
+}
+
void cmGlobalGenerator::Configure()
{
// Delete any existing cmLocalGenerators
diff --git a/Source/cmGlobalGenerator.h b/Source/cmGlobalGenerator.h
index d95a555..90a907e 100644
--- a/Source/cmGlobalGenerator.h
+++ b/Source/cmGlobalGenerator.h
@@ -168,6 +168,9 @@ public:
///! Find a target by name by searching the local generators.
cmTarget* FindTarget(const char* project, const char* name);
+ /** If check to see if the target is linked to by any other
+ target in the project */
+ bool IsDependedOn(const char* project, cmTarget* target);
///! Find a local generator by its startdirectory
cmLocalGenerator* FindLocalGenerator(const char* start_dir);
diff --git a/Source/cmGlobalVisualStudio71Generator.cxx b/Source/cmGlobalVisualStudio71Generator.cxx
index d5d4d51..acb62af 100644
--- a/Source/cmGlobalVisualStudio71Generator.cxx
+++ b/Source/cmGlobalVisualStudio71Generator.cxx
@@ -254,13 +254,16 @@ void cmGlobalVisualStudio71Generator
const cmCustomCommandLines& cmds = cc.GetCommandLines();
std::string project = cmds[0][0];
this->WriteProjectConfigurations(fout, project.c_str(),
- l->second.GetType());
+ true);
}
else if ((l->second.GetType() != cmTarget::INSTALL_FILES)
&& (l->second.GetType() != cmTarget::INSTALL_PROGRAMS))
{
+ bool partOfDefaultBuild = this->IsPartOfDefaultBuild(
+ root->GetMakefile()->GetProjectName(),
+ &l->second);
this->WriteProjectConfigurations(fout, si->c_str(),
- l->second.GetType());
+ partOfDefaultBuild);
++si;
}
}
@@ -415,15 +418,15 @@ void cmGlobalVisualStudio71Generator
// executables to the libraries it uses are also done here
void cmGlobalVisualStudio71Generator
::WriteProjectConfigurations(std::ostream& fout, const char* name,
- int targetType)
+ bool partOfDefaultBuild)
{
std::string guid = this->GetGUID(name);
for(std::vector<std::string>::iterator i = this->Configurations.begin();
i != this->Configurations.end(); ++i)
{
- fout << "\t\t{" << guid << "}." << *i
+ fout << "\t\t{" << guid << "}." << *i
<< ".ActiveCfg = " << *i << "|Win32\n";
- if(targetType != cmTarget::GLOBAL_TARGET)
+ if(partOfDefaultBuild)
{
fout << "\t\t{" << guid << "}." << *i
<< ".Build.0 = " << *i << "|Win32\n";
diff --git a/Source/cmGlobalVisualStudio71Generator.h b/Source/cmGlobalVisualStudio71Generator.h
index e730b36..c8a2385 100644
--- a/Source/cmGlobalVisualStudio71Generator.h
+++ b/Source/cmGlobalVisualStudio71Generator.h
@@ -55,7 +55,7 @@ protected:
const char* name, const char* path, cmTarget &t);
virtual void WriteProjectConfigurations(std::ostream& fout,
const char* name,
- int targetType);
+ bool partOfDefaultBuild);
virtual void WriteExternalProject(std::ostream& fout, const char* name,
const char* path,
const std::vector<std::string>& depends);
diff --git a/Source/cmGlobalVisualStudio7Generator.cxx b/Source/cmGlobalVisualStudio7Generator.cxx
index ec24d22..a5c67e9 100644
--- a/Source/cmGlobalVisualStudio7Generator.cxx
+++ b/Source/cmGlobalVisualStudio7Generator.cxx
@@ -537,13 +537,16 @@ void cmGlobalVisualStudio7Generator
const cmCustomCommandLines& cmds = cc.GetCommandLines();
std::string name = cmds[0][0];
this->WriteProjectConfigurations(fout, name.c_str(),
- l->second.GetType());
+ true);
}
else if ((l->second.GetType() != cmTarget::INSTALL_FILES)
&& (l->second.GetType() != cmTarget::INSTALL_PROGRAMS))
- {
+ {
+ bool partOfDefaultBuild = this->IsPartOfDefaultBuild(
+ root->GetMakefile()->GetProjectName(),
+ &l->second);
this->WriteProjectConfigurations(fout, si->c_str(),
- l->second.GetType());
+ partOfDefaultBuild);
++si;
}
}
@@ -667,7 +670,7 @@ cmGlobalVisualStudio7Generator
// executables to the libraries it uses are also done here
void cmGlobalVisualStudio7Generator
::WriteProjectConfigurations(std::ostream& fout, const char* name,
- int targetType)
+ bool partOfDefaultBuild)
{
std::string guid = this->GetGUID(name);
for(std::vector<std::string>::iterator i = this->Configurations.begin();
@@ -675,7 +678,7 @@ void cmGlobalVisualStudio7Generator
{
fout << "\t\t{" << guid << "}." << *i
<< ".ActiveCfg = " << *i << "|Win32\n";
- if(targetType != cmTarget::GLOBAL_TARGET)
+ if(partOfDefaultBuild)
{
fout << "\t\t{" << guid << "}." << *i
<< ".Build.0 = " << *i << "|Win32\n";
@@ -799,3 +802,25 @@ cmGlobalVisualStudio7Generator
dir += suffix;
}
}
+
+bool cmGlobalVisualStudio7Generator::IsPartOfDefaultBuild(const char* project,
+ cmTarget* target)
+{
+ if(target->GetPropertyAsBool("EXCLUDE_FROM_DEFAULT_BUILD"))
+ {
+ return false;
+ }
+ // if it is a utilitiy target then only make it part of the
+ // default build if another target depends on it
+ int type = target->GetType();
+ if (type == cmTarget::GLOBAL_TARGET)
+ {
+ return false;
+ }
+ if(type == cmTarget::UTILITY)
+ {
+ return this->IsDependedOn(project, target);
+ }
+ // default is to be part of the build
+ return true;
+}
diff --git a/Source/cmGlobalVisualStudio7Generator.h b/Source/cmGlobalVisualStudio7Generator.h
index e46480b..7e36cf2 100644
--- a/Source/cmGlobalVisualStudio7Generator.h
+++ b/Source/cmGlobalVisualStudio7Generator.h
@@ -107,7 +107,7 @@ protected:
const char* name, const char* path, cmTarget &t);
virtual void WriteProjectConfigurations(std::ostream& fout,
const char* name,
- int targetType);
+ bool partOfDefaultBuild);
virtual void WriteSLNFooter(std::ostream& fout);
virtual void WriteSLNHeader(std::ostream& fout);
virtual void AddPlatformDefinitions(cmMakefile* mf);
@@ -120,6 +120,8 @@ protected:
std::string ConvertToSolutionPath(const char* path);
+ bool IsPartOfDefaultBuild(const char* project,
+ cmTarget* target);
std::vector<std::string> Configurations;
std::map<cmStdString, cmStdString> GUIDMap;
diff --git a/Source/cmGlobalVisualStudio8Generator.cxx b/Source/cmGlobalVisualStudio8Generator.cxx
index bb87489..f2f29b5 100644
--- a/Source/cmGlobalVisualStudio8Generator.cxx
+++ b/Source/cmGlobalVisualStudio8Generator.cxx
@@ -228,7 +228,7 @@ cmGlobalVisualStudio8Generator
void
cmGlobalVisualStudio8Generator
::WriteProjectConfigurations(std::ostream& fout, const char* name,
- int targetType)
+ bool partOfDefaultBuild)
{
std::string guid = this->GetGUID(name);
for(std::vector<std::string>::iterator i = this->Configurations.begin();
@@ -237,7 +237,7 @@ cmGlobalVisualStudio8Generator
fout << "\t\t{" << guid << "}." << *i
<< "|" << this->PlatformName << ".ActiveCfg = "
<< *i << "|" << this->PlatformName << "\n";
- if(targetType != cmTarget::GLOBAL_TARGET)
+ if(partOfDefaultBuild)
{
fout << "\t\t{" << guid << "}." << *i
<< "|" << this->PlatformName << ".Build.0 = "
diff --git a/Source/cmGlobalVisualStudio8Generator.h b/Source/cmGlobalVisualStudio8Generator.h
index fdc8316..68a2335 100644
--- a/Source/cmGlobalVisualStudio8Generator.h
+++ b/Source/cmGlobalVisualStudio8Generator.h
@@ -57,7 +57,7 @@ protected:
virtual void WriteSolutionConfigurations(std::ostream& fout);
virtual void WriteProjectConfigurations(std::ostream& fout,
const char* name,
- int targetType);
+ bool partOfDefaultBuild);
std::string PlatformName; // Win32 or x64
};
#endif
diff --git a/Source/cmSetTargetPropertiesCommand.h b/Source/cmSetTargetPropertiesCommand.h
index cf777a6..009127f 100644
--- a/Source/cmSetTargetPropertiesCommand.h
+++ b/Source/cmSetTargetPropertiesCommand.h
@@ -149,6 +149,10 @@ public:
"installing a target. They are used only when the old "
"INSTALL_TARGETS command is used to install the target. Use the "
"INSTALL command instead."
+ "\n"
+ "The EXCLUDE_FROM_DEFAULT_BUILD property is used by the visual "
+ "studio generators. If it is set to 1 the target will not be "
+ "part of the default build when you select \"Build Solution\"."
;
}