summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2005-04-28 20:21:28 (GMT)
committerBrad King <brad.king@kitware.com>2005-04-28 20:21:28 (GMT)
commit3b81a4329420f0cb2ea0f3e7a4662c903e1b3aa0 (patch)
treedb6dd24c9e4d4d1a6504b63656d73d3039373a0c
parent3a81832bb3ae22f6251ab810fbd17a7ec57ff9bb (diff)
downloadCMake-3b81a4329420f0cb2ea0f3e7a4662c903e1b3aa0.zip
CMake-3b81a4329420f0cb2ea0f3e7a4662c903e1b3aa0.tar.gz
CMake-3b81a4329420f0cb2ea0f3e7a4662c903e1b3aa0.tar.bz2
ENH: Added dependency from INSTALL target to ALL_BUILD target so that targets build before being installed.
-rw-r--r--Source/cmGlobalVisualStudio6Generator.cxx25
-rw-r--r--Source/cmGlobalVisualStudio6Generator.h2
-rw-r--r--Source/cmGlobalVisualStudio71Generator.cxx44
-rw-r--r--Source/cmGlobalVisualStudio71Generator.h4
-rw-r--r--Source/cmGlobalVisualStudio7Generator.cxx40
-rw-r--r--Source/cmGlobalVisualStudio7Generator.h2
6 files changed, 94 insertions, 23 deletions
diff --git a/Source/cmGlobalVisualStudio6Generator.cxx b/Source/cmGlobalVisualStudio6Generator.cxx
index e392f55..917581c 100644
--- a/Source/cmGlobalVisualStudio6Generator.cxx
+++ b/Source/cmGlobalVisualStudio6Generator.cxx
@@ -290,6 +290,7 @@ void cmGlobalVisualStudio6Generator::WriteDSWFile(std::ostream& fout,
if ((l->second.GetType() != cmTarget::INSTALL_FILES)
&& (l->second.GetType() != cmTarget::INSTALL_PROGRAMS))
{
+ const char* extra_depend = 0;
bool skip = false;
// skip ALL_BUILD and RUN_TESTS if they have already been added
if(l->first == "ALL_BUILD" )
@@ -313,6 +314,16 @@ void cmGlobalVisualStudio6Generator::WriteDSWFile(std::ostream& fout,
{
doneInstall = true;
}
+
+ // Make the INSTALL target depend on ALL_BUILD unless the
+ // project says to not do so.
+ const char* noall =
+ root->GetMakefile()
+ ->GetDefinition("CMAKE_SKIP_INSTALL_ALL_DEPENDENCY");
+ if(!noall || cmSystemTools::IsOff(noall))
+ {
+ extra_depend = "ALL_BUILD";
+ }
}
if(l->first == "RUN_TESTS")
{
@@ -327,7 +338,8 @@ void cmGlobalVisualStudio6Generator::WriteDSWFile(std::ostream& fout,
}
if(!skip)
{
- this->WriteProject(fout, si->c_str(), dir.c_str(),l->second);
+ this->WriteProject(fout, si->c_str(), dir.c_str(),l->second,
+ extra_depend);
}
++si;
}
@@ -377,7 +389,8 @@ void cmGlobalVisualStudio6Generator::OutputDSWFile()
void cmGlobalVisualStudio6Generator::WriteProject(std::ostream& fout,
const char* dspname,
const char* dir,
- const cmTarget& target)
+ const cmTarget& target,
+ const char* extra_depend)
{
fout << "#########################################################"
"######################\n\n";
@@ -411,6 +424,14 @@ void cmGlobalVisualStudio6Generator::WriteProject(std::ostream& fout,
}
}
+ // Add an extra dependency if specified.
+ if(extra_depend)
+ {
+ fout << "Begin Project Dependency\n";
+ fout << "Project_Dep_Name " << extra_depend << "\n";
+ fout << "End Project Dependency\n";
+ }
+
std::set<cmStdString>::const_iterator i, end;
// write utility dependencies.
i = target.GetUtilities().begin();
diff --git a/Source/cmGlobalVisualStudio6Generator.h b/Source/cmGlobalVisualStudio6Generator.h
index 5dbef61..b31b3ca 100644
--- a/Source/cmGlobalVisualStudio6Generator.h
+++ b/Source/cmGlobalVisualStudio6Generator.h
@@ -82,7 +82,7 @@ private:
void WriteDSWHeader(std::ostream& fout);
void WriteProject(std::ostream& fout,
const char* name, const char* path,
- const cmTarget &t);
+ const cmTarget &t, const char* extra_depend);
void WriteExternalProject(std::ostream& fout,
const char* name, const char* path,
const std::vector<std::string>& dependencies);
diff --git a/Source/cmGlobalVisualStudio71Generator.cxx b/Source/cmGlobalVisualStudio71Generator.cxx
index 0716773..8d87f2a 100644
--- a/Source/cmGlobalVisualStudio71Generator.cxx
+++ b/Source/cmGlobalVisualStudio71Generator.cxx
@@ -130,6 +130,7 @@ void cmGlobalVisualStudio71Generator::WriteSLNFile(std::ostream& fout,
if ((l->second.GetType() != cmTarget::INSTALL_FILES)
&& (l->second.GetType() != cmTarget::INSTALL_PROGRAMS))
{
+ const char* extra_depend = 0;
bool skip = false;
if(l->first == "ALL_BUILD" )
{
@@ -152,6 +153,15 @@ void cmGlobalVisualStudio71Generator::WriteSLNFile(std::ostream& fout,
{
doneInstall = true;
}
+ // Make the INSTALL target depend on ALL_BUILD unless the
+ // project says to not do so.
+ const char* noall =
+ root->GetMakefile()
+ ->GetDefinition("CMAKE_SKIP_INSTALL_ALL_DEPENDENCY");
+ if(!noall || cmSystemTools::IsOff(noall))
+ {
+ extra_depend = "ALL_BUILD";
+ }
}
if(l->first == "RUN_TESTS")
{
@@ -166,7 +176,8 @@ void cmGlobalVisualStudio71Generator::WriteSLNFile(std::ostream& fout,
}
if(!skip)
{
- this->WriteProject(fout, si->c_str(), dir.c_str(),l->second);
+ this->WriteProject(fout, si->c_str(), dir.c_str(),l->second,
+ extra_depend);
}
++si;
}
@@ -225,10 +236,12 @@ void cmGlobalVisualStudio71Generator::WriteSLNFile(std::ostream& fout,
// Write a dsp file into the SLN file,
// Note, that dependencies from executables to
// the libraries it uses are also done here
-void cmGlobalVisualStudio71Generator::WriteProject(std::ostream& fout,
- const char* dspname,
- const char* dir,
- const cmTarget& t)
+void
+cmGlobalVisualStudio71Generator::WriteProject(std::ostream& fout,
+ const char* dspname,
+ const char* dir,
+ const cmTarget& t,
+ const char* extra_depend)
{
std::string d = cmSystemTools::ConvertToOutputPath(dir);
fout << "Project(\"{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}\") = \""
@@ -236,7 +249,7 @@ void cmGlobalVisualStudio71Generator::WriteProject(std::ostream& fout,
<< d << "\\" << dspname << ".vcproj\", \"{"
<< this->GetGUID(dspname) << "}\"\n";
fout << "\tProjectSection(ProjectDependencies) = postProject\n";
- this->WriteProjectDepends(fout, dspname, dir, t);
+ this->WriteProjectDepends(fout, dspname, dir, t, extra_depend);
fout << "\tEndProjectSection\n";
fout <<"EndProject\n";
@@ -247,11 +260,13 @@ void cmGlobalVisualStudio71Generator::WriteProject(std::ostream& fout,
// Write a dsp file into the SLN file,
// Note, that dependencies from executables to
// the libraries it uses are also done here
-void cmGlobalVisualStudio71Generator::WriteProjectDepends(std::ostream& fout,
- const char* dspname,
- const char* ,
- const cmTarget& target
- )
+void
+cmGlobalVisualStudio71Generator
+::WriteProjectDepends(std::ostream& fout,
+ const char* dspname,
+ const char*,
+ const cmTarget& target,
+ const char* extra_depend)
{
// insert Begin Project Dependency Project_Dep_Name project stuff here
if (target.GetType() != cmTarget::STATIC_LIBRARY)
@@ -276,6 +291,13 @@ void cmGlobalVisualStudio71Generator::WriteProjectDepends(std::ostream& fout,
}
}
+ // Add the extra dependency if requested.
+ if(extra_depend)
+ {
+ fout << "\t\t{" << this->GetGUID(extra_depend) << "} = {"
+ << this->GetGUID(extra_depend) << "}\n";
+ }
+
std::set<cmStdString>::const_iterator i, end;
// write utility dependencies.
i = target.GetUtilities().begin();
diff --git a/Source/cmGlobalVisualStudio71Generator.h b/Source/cmGlobalVisualStudio71Generator.h
index a5a47a8..1ae3fa9 100644
--- a/Source/cmGlobalVisualStudio71Generator.h
+++ b/Source/cmGlobalVisualStudio71Generator.h
@@ -48,10 +48,10 @@ protected:
std::vector<cmLocalGenerator*>& generators);
virtual void WriteProject(std::ostream& fout,
const char* name, const char* path,
- const cmTarget &t);
+ const cmTarget &t, const char* extra_depend);
virtual void WriteProjectDepends(std::ostream& fout,
const char* name, const char* path,
- const cmTarget &t);
+ const cmTarget &t, const char* extra_depend);
virtual void WriteProjectConfigurations(std::ostream& fout, const char* name, bool in_all);
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 7172d7c..5dbc678 100644
--- a/Source/cmGlobalVisualStudio7Generator.cxx
+++ b/Source/cmGlobalVisualStudio7Generator.cxx
@@ -453,7 +453,21 @@ void cmGlobalVisualStudio7Generator::WriteSLNFile(std::ostream& fout,
else if ((l->second.GetType() != cmTarget::INSTALL_FILES)
&& (l->second.GetType() != cmTarget::INSTALL_PROGRAMS))
{
- this->WriteProjectDepends(fout, si->c_str(), dir.c_str(),l->second);
+ // Make the INSTALL target depend on ALL_BUILD unless the
+ // project says to not do so.
+ const char* extra_depend = 0;
+ if(l->first == "INSTALL")
+ {
+ const char* noall =
+ root->GetMakefile()
+ ->GetDefinition("CMAKE_SKIP_INSTALL_ALL_DEPENDENCY");
+ if(!noall || cmSystemTools::IsOff(noall))
+ {
+ extra_depend = "ALL_BUILD";
+ }
+ }
+ this->WriteProjectDepends(fout, si->c_str(), dir.c_str(), l->second,
+ extra_depend);
++si;
}
}
@@ -519,11 +533,13 @@ void cmGlobalVisualStudio7Generator::WriteProject(std::ostream& fout,
// Write a dsp file into the SLN file,
// Note, that dependencies from executables to
// the libraries it uses are also done here
-void cmGlobalVisualStudio7Generator::WriteProjectDepends(std::ostream& fout,
- const char* dspname,
- const char* ,
- const cmTarget& target
- )
+void
+cmGlobalVisualStudio7Generator
+::WriteProjectDepends(std::ostream& fout,
+ const char* dspname,
+ const char*,
+ const cmTarget& target,
+ const char* extra_depend)
{
int depcount = 0;
// insert Begin Project Dependency Project_Dep_Name project stuff here
@@ -560,6 +576,18 @@ void cmGlobalVisualStudio7Generator::WriteProjectDepends(std::ostream& fout,
}
}
+ // Add the extra dependency if requested.
+ if(extra_depend)
+ {
+ std::string guid = this->GetGUID(extra_depend);
+ if(!guid.empty())
+ {
+ fout << "\t\t{" << this->GetGUID(dspname) << "}." << depcount << " = {"
+ << guid << "}\n";
+ depcount++;
+ }
+ }
+
std::set<cmStdString>::const_iterator i, end;
// write utility dependencies.
i = target.GetUtilities().begin();
diff --git a/Source/cmGlobalVisualStudio7Generator.h b/Source/cmGlobalVisualStudio7Generator.h
index fbc1489..dea1c15 100644
--- a/Source/cmGlobalVisualStudio7Generator.h
+++ b/Source/cmGlobalVisualStudio7Generator.h
@@ -92,7 +92,7 @@ protected:
const cmTarget &t);
virtual void WriteProjectDepends(std::ostream& fout,
const char* name, const char* path,
- const cmTarget &t);
+ const cmTarget &t, const char* extra_depend);
virtual void WriteProjectConfigurations(std::ostream& fout, const char* name, bool in_all);
virtual void WriteSLNFooter(std::ostream& fout);
virtual void WriteSLNHeader(std::ostream& fout);