summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2007-05-23 15:40:12 -0400
committerBrad King <brad.king@kitware.com>2007-05-23 15:40:12 -0400
commitba7780a3c494f2c2989e9528366c69dafbdccfec (patch)
tree38d791d439b11d6b02b9e3c4f20123b2b9734259
parent303b4312b2c28329a2aecde7d7ddd84137efa1ce (diff)
downloadcmake-ba7780a3c494f2c2989e9528366c69dafbdccfec.tar.gz
ENH: Fixed INSTALL_FILES and INSTALL_PROGRAMS commands to not create targets. No targets of type cmTarget::INSTALL_FILES or cmTarget::INSTALL_PROGRAMS are created, so we do not need to check for them everywhere anymore.
-rw-r--r--Source/cmExportLibraryDependencies.cxx34
-rw-r--r--Source/cmGlobalVisualStudio6Generator.cxx4
-rw-r--r--Source/cmGlobalVisualStudio71Generator.cxx7
-rw-r--r--Source/cmGlobalVisualStudio7Generator.cxx10
-rw-r--r--Source/cmGlobalXCodeGenerator.cxx10
-rw-r--r--Source/cmInstallFilesCommand.cxx31
-rw-r--r--Source/cmInstallFilesCommand.h3
-rw-r--r--Source/cmInstallProgramsCommand.cxx26
-rw-r--r--Source/cmInstallProgramsCommand.h3
-rw-r--r--Source/cmLocalGenerator.cxx5
-rw-r--r--Source/cmLocalVisualStudio6Generator.cxx8
-rw-r--r--Source/cmLocalVisualStudio7Generator.cxx4
-rw-r--r--Source/cmMakefile.cxx2
-rw-r--r--Source/cmTarget.cxx12
14 files changed, 64 insertions, 95 deletions
diff --git a/Source/cmExportLibraryDependencies.cxx b/Source/cmExportLibraryDependencies.cxx
index a5d66e75b2..bf9d5339b2 100644
--- a/Source/cmExportLibraryDependencies.cxx
+++ b/Source/cmExportLibraryDependencies.cxx
@@ -94,28 +94,24 @@ void cmExportLibraryDependenciesCommand::FinalPass()
for(cmTargets::iterator l = tgts.begin();
l != tgts.end(); ++l)
{
- if ((l->second.GetType() != cmTarget::INSTALL_FILES)
- && (l->second.GetType() != cmTarget::INSTALL_PROGRAMS))
+ libDepName = l->first;
+ libDepName += "_LIB_DEPENDS";
+ const char* def = this->Makefile->GetDefinition(libDepName.c_str());
+ if(def)
{
- libDepName = l->first;
- libDepName += "_LIB_DEPENDS";
- const char* def = this->Makefile->GetDefinition(libDepName.c_str());
- if(def)
+ fout << "SET(" << libDepName << " \"" << def << "\")\n";
+ // now for each dependency, check for link type
+ cmSystemTools::ExpandListArgument(def, depends);
+ for(std::vector<std::string>::const_iterator d = depends.begin();
+ d != depends.end(); ++d)
{
- fout << "SET(" << libDepName << " \"" << def << "\")\n";
- // now for each dependency, check for link type
- cmSystemTools::ExpandListArgument(def, depends);
- for(std::vector<std::string>::const_iterator d = depends.begin();
- d != depends.end(); ++d)
+ libDepName = *d;
+ libDepName += "_LINK_TYPE";
+ defType = this->Makefile->GetDefinition(libDepName.c_str());
+ libDepName = cmSystemTools::EscapeSpaces(libDepName.c_str());
+ if(defType)
{
- libDepName = *d;
- libDepName += "_LINK_TYPE";
- defType = this->Makefile->GetDefinition(libDepName.c_str());
- libDepName = cmSystemTools::EscapeSpaces(libDepName.c_str());
- if(defType)
- {
- fout << "SET(" << libDepName << " \"" << defType << "\")\n";
- }
+ fout << "SET(" << libDepName << " \"" << defType << "\")\n";
}
}
}
diff --git a/Source/cmGlobalVisualStudio6Generator.cxx b/Source/cmGlobalVisualStudio6Generator.cxx
index 13758c5630..2ed4f40dae 100644
--- a/Source/cmGlobalVisualStudio6Generator.cxx
+++ b/Source/cmGlobalVisualStudio6Generator.cxx
@@ -256,9 +256,6 @@ void cmGlobalVisualStudio6Generator
}
else
{
- if ((l->second.GetType() != cmTarget::INSTALL_FILES)
- && (l->second.GetType() != cmTarget::INSTALL_PROGRAMS))
- {
bool skip = false;
// skip ALL_BUILD and RUN_TESTS if they have already been added
if(l->first == "ALL_BUILD" )
@@ -332,7 +329,6 @@ void cmGlobalVisualStudio6Generator
this->WriteProject(fout, si->c_str(), dir.c_str(),l->second);
}
++si;
- }
}
}
}
diff --git a/Source/cmGlobalVisualStudio71Generator.cxx b/Source/cmGlobalVisualStudio71Generator.cxx
index fe67f01e7d..fe39318b9b 100644
--- a/Source/cmGlobalVisualStudio71Generator.cxx
+++ b/Source/cmGlobalVisualStudio71Generator.cxx
@@ -134,9 +134,6 @@ void cmGlobalVisualStudio71Generator
}
else
{
- if ((l->second.GetType() != cmTarget::INSTALL_FILES)
- && (l->second.GetType() != cmTarget::INSTALL_PROGRAMS))
- {
bool skip = false;
if(l->first == "ALL_BUILD" )
{
@@ -224,7 +221,6 @@ void cmGlobalVisualStudio71Generator
this->WriteProject(fout, dspname, dir.c_str(),l->second);
}
}
- }
}
}
}
@@ -254,8 +250,7 @@ void cmGlobalVisualStudio71Generator
this->WriteProjectConfigurations(fout, project.c_str(),
true);
}
- else if ((l->second.GetType() != cmTarget::INSTALL_FILES)
- && (l->second.GetType() != cmTarget::INSTALL_PROGRAMS))
+ else
{
bool partOfDefaultBuild = this->IsPartOfDefaultBuild(
root->GetMakefile()->GetProjectName(),
diff --git a/Source/cmGlobalVisualStudio7Generator.cxx b/Source/cmGlobalVisualStudio7Generator.cxx
index a4d22583b7..8ccdb849af 100644
--- a/Source/cmGlobalVisualStudio7Generator.cxx
+++ b/Source/cmGlobalVisualStudio7Generator.cxx
@@ -341,9 +341,6 @@ void cmGlobalVisualStudio7Generator
}
else
{
- if ((l->second.GetType() != cmTarget::INSTALL_FILES)
- && (l->second.GetType() != cmTarget::INSTALL_PROGRAMS))
- {
bool skip = false;
if(l->first == "ALL_BUILD" )
{
@@ -420,7 +417,6 @@ void cmGlobalVisualStudio7Generator
this->WriteProject(fout, dspname, dir.c_str(),l->second);
}
}
- }
}
}
}
@@ -476,8 +472,7 @@ void cmGlobalVisualStudio7Generator
depcount++;
}
}
- else if ((l->second.GetType() != cmTarget::INSTALL_FILES)
- && (l->second.GetType() != cmTarget::INSTALL_PROGRAMS))
+ else
{
const char *dspname =
l->second.GetProperty("GENERATOR_FILE_NAME");
@@ -513,8 +508,7 @@ void cmGlobalVisualStudio7Generator
this->WriteProjectConfigurations(fout, name.c_str(),
true);
}
- else if ((l->second.GetType() != cmTarget::INSTALL_FILES)
- && (l->second.GetType() != cmTarget::INSTALL_PROGRAMS))
+ else
{
bool partOfDefaultBuild = this->IsPartOfDefaultBuild(
root->GetMakefile()->GetProjectName(),
diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx
index 6662236655..ee09b21576 100644
--- a/Source/cmGlobalXCodeGenerator.cxx
+++ b/Source/cmGlobalXCodeGenerator.cxx
@@ -596,12 +596,6 @@ cmGlobalXCodeGenerator::CreateXCodeTargets(cmLocalGenerator* gen,
cmtarget.GetType() == cmTarget::GLOBAL_TARGET)
{
targets.push_back(this->CreateUtilityTarget(cmtarget));
- }
- if(cmtarget.GetType() == cmTarget::UTILITY ||
- cmtarget.GetType() == cmTarget::GLOBAL_TARGET ||
- cmtarget.GetType() == cmTarget::INSTALL_FILES ||
- cmtarget.GetType() == cmTarget::INSTALL_PROGRAMS)
- {
continue;
}
@@ -2498,9 +2492,7 @@ cmGlobalXCodeGenerator::OutputXCodeProject(cmLocalGenerator* root,
for(cmTargets::iterator l = tgts.begin();
l != tgts.end(); l++)
{
- if ((l->second.GetType() != cmTarget::INSTALL_FILES)
- && (l->second.GetType() != cmTarget::INSTALL_PROGRAMS)
- && (strncmp(l->first.c_str(),
+ if ((strncmp(l->first.c_str(),
"INCLUDE_EXTERNAL_MSPROJECT", 26) != 0)
&& banned.find(l->second.GetName()) == banned.end())
{
diff --git a/Source/cmInstallFilesCommand.cxx b/Source/cmInstallFilesCommand.cxx
index 33c0899c34..e608484c2a 100644
--- a/Source/cmInstallFilesCommand.cxx
+++ b/Source/cmInstallFilesCommand.cxx
@@ -16,6 +16,8 @@
=========================================================================*/
#include "cmInstallFilesCommand.h"
+#include "cmInstallFilesGenerator.h"
+
// cmExecutableCommand
bool cmInstallFilesCommand
::InitialPass(std::vector<std::string> const& argsIn)
@@ -33,14 +35,8 @@ bool cmInstallFilesCommand
std::vector<std::string> args;
this->Makefile->ExpandSourceListArguments(argsIn, args, 2);
- // Create an INSTALL_FILES target specifically for this path.
- this->TargetName = "INSTALL_FILES_"+args[0];
- cmTarget& target = this->Makefile->GetTargets()[this->TargetName];
- target.SetType(cmTarget::INSTALL_FILES, this->TargetName.c_str());
- target.SetMakefile(this->Makefile);
- target.SetProperty("EXCLUDE_FROM_ALL","TRUE");
- target.SetInstallPath(args[0].c_str());
-
+ this->Destination = args[0];
+
if((args.size() > 1) && (args[1] == "FILES"))
{
this->IsFilesForm = true;
@@ -49,7 +45,7 @@ bool cmInstallFilesCommand
{
// Find the source location for each file listed.
std::string f = this->FindInstallSource(s->c_str());
- target.GetSourceLists().push_back(f);
+ this->Files.push_back(f);
}
}
else
@@ -75,8 +71,6 @@ void cmInstallFilesCommand::FinalPass()
std::string testf;
std::string ext = this->FinalArgs[0];
- std::vector<std::string>& targetSourceLists =
- this->Makefile->GetTargets()[this->TargetName].GetSourceLists();
// two different options
if (this->FinalArgs.size() > 1)
@@ -100,7 +94,7 @@ void cmInstallFilesCommand::FinalPass()
}
// add to the result
- targetSourceLists.push_back(this->FindInstallSource(testf.c_str()));
+ this->Files.push_back(this->FindInstallSource(testf.c_str()));
}
}
else // reg exp list
@@ -114,9 +108,20 @@ void cmInstallFilesCommand::FinalPass()
// for each argument, get the files
for (;s != files.end(); ++s)
{
- targetSourceLists.push_back(this->FindInstallSource(s->c_str()));
+ this->Files.push_back(this->FindInstallSource(s->c_str()));
}
}
+
+ // Use a file install generator.
+ const char* no_permissions = "";
+ const char* no_rename = "";
+ const char* no_component = "";
+ std::vector<std::string> no_configurations;
+ this->Makefile->AddInstallGenerator(
+ new cmInstallFilesGenerator(this->Files,
+ this->Destination.c_str(), false,
+ no_permissions, no_configurations,
+ no_component, no_rename));
}
/**
diff --git a/Source/cmInstallFilesCommand.h b/Source/cmInstallFilesCommand.h
index ec1ad9ddcd..5d7501da2f 100644
--- a/Source/cmInstallFilesCommand.h
+++ b/Source/cmInstallFilesCommand.h
@@ -106,9 +106,10 @@ protected:
std::string FindInstallSource(const char* name) const;
private:
- std::string TargetName;
std::vector<std::string> FinalArgs;
bool IsFilesForm;
+ std::string Destination;
+ std::vector<std::string> Files;
};
diff --git a/Source/cmInstallProgramsCommand.cxx b/Source/cmInstallProgramsCommand.cxx
index 0b320a4738..bd137dddef 100644
--- a/Source/cmInstallProgramsCommand.cxx
+++ b/Source/cmInstallProgramsCommand.cxx
@@ -30,13 +30,7 @@ bool cmInstallProgramsCommand
this->Makefile->GetLocalGenerator()
->GetGlobalGenerator()->EnableInstallTarget();
- // Create an INSTALL_PROGRAMS target specifically for this path.
- this->TargetName = "INSTALL_PROGRAMS_"+args[0];
- cmTarget& target = this->Makefile->GetTargets()[this->TargetName];
- target.SetType(cmTarget::INSTALL_PROGRAMS, this->TargetName.c_str());
- target.SetMakefile(this->Makefile);
- target.SetProperty("EXCLUDE_FROM_ALL","TRUE");
- target.SetInstallPath(args[0].c_str());
+ this->Destination = args[0];
std::vector<std::string>::const_iterator s = args.begin();
for (++s;s != args.end(); ++s)
@@ -49,9 +43,6 @@ bool cmInstallProgramsCommand
void cmInstallProgramsCommand::FinalPass()
{
- std::vector<std::string>& targetSourceLists =
- this->Makefile->GetTargets()[this->TargetName].GetSourceLists();
-
bool files_mode = false;
if(!this->FinalArgs.empty() && this->FinalArgs[0] == "FILES")
{
@@ -71,7 +62,7 @@ void cmInstallProgramsCommand::FinalPass()
for(;s != this->FinalArgs.end(); ++s)
{
// add to the result
- targetSourceLists.push_back(this->FindInstallSource(s->c_str()));
+ this->Files.push_back(this->FindInstallSource(s->c_str()));
}
}
else // reg exp list
@@ -84,9 +75,20 @@ void cmInstallProgramsCommand::FinalPass()
// for each argument, get the programs
for (;s != programs.end(); ++s)
{
- targetSourceLists.push_back(this->FindInstallSource(s->c_str()));
+ this->Files.push_back(this->FindInstallSource(s->c_str()));
}
}
+
+ // Use a file install generator.
+ const char* no_permissions = "";
+ const char* no_rename = "";
+ const char* no_component = "";
+ std::vector<std::string> no_configurations;
+ this->Makefile->AddInstallGenerator(
+ new cmInstallFilesGenerator(this->Files,
+ this->Destination.c_str(), true,
+ no_permissions, no_configurations,
+ no_component, no_rename));
}
/**
diff --git a/Source/cmInstallProgramsCommand.h b/Source/cmInstallProgramsCommand.h
index 3fe2bf3bcf..6b085f5bff 100644
--- a/Source/cmInstallProgramsCommand.h
+++ b/Source/cmInstallProgramsCommand.h
@@ -101,8 +101,9 @@ public:
protected:
std::string FindInstallSource(const char* name) const;
private:
- std::string TargetName;
std::vector<std::string> FinalArgs;
+ std::string Destination;
+ std::vector<std::string> Files;
};
diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx
index 052663a741..874779cf50 100644
--- a/Source/cmLocalGenerator.cxx
+++ b/Source/cmLocalGenerator.cxx
@@ -145,10 +145,7 @@ void cmLocalGenerator::TraceDependencies()
{
// INCLUDE_EXTERNAL_MSPROJECT command only affects the workspace
// so don't build a projectfile for it
- if ((t->second.GetType() != cmTarget::INSTALL_FILES)
- && (t->second.GetType() != cmTarget::INSTALL_PROGRAMS)
- && (t->second.GetType() != cmTarget::INSTALL_DIRECTORY)
- && (strncmp(t->first.c_str(), "INCLUDE_EXTERNAL_MSPROJECT", 26) != 0))
+ if (strncmp(t->first.c_str(), "INCLUDE_EXTERNAL_MSPROJECT", 26) != 0)
{
std::string projectFilename;
if (this->IsMakefileGenerator == false) // only use of this variable
diff --git a/Source/cmLocalVisualStudio6Generator.cxx b/Source/cmLocalVisualStudio6Generator.cxx
index b877cb9f62..41f00a69a6 100644
--- a/Source/cmLocalVisualStudio6Generator.cxx
+++ b/Source/cmLocalVisualStudio6Generator.cxx
@@ -141,19 +141,13 @@ void cmLocalVisualStudio6Generator::OutputDSPFile()
case cmTarget::GLOBAL_TARGET:
this->SetBuildType(UTILITY, l->first.c_str(), l->second);
break;
- case cmTarget::INSTALL_FILES:
- break;
- case cmTarget::INSTALL_PROGRAMS:
- break;
default:
cmSystemTools::Error("Bad target type", l->first.c_str());
break;
}
// INCLUDE_EXTERNAL_MSPROJECT command only affects the workspace
// so don't build a projectfile for it
- if ((l->second.GetType() != cmTarget::INSTALL_FILES)
- && (l->second.GetType() != cmTarget::INSTALL_PROGRAMS)
- && (strncmp(l->first.c_str(), "INCLUDE_EXTERNAL_MSPROJECT", 26) != 0))
+ if (strncmp(l->first.c_str(), "INCLUDE_EXTERNAL_MSPROJECT", 26) != 0)
{
// check to see if the dsp is going into a sub-directory
std::string::size_type pos = l->first.rfind('/');
diff --git a/Source/cmLocalVisualStudio7Generator.cxx b/Source/cmLocalVisualStudio7Generator.cxx
index ec3842147e..f3b594db4a 100644
--- a/Source/cmLocalVisualStudio7Generator.cxx
+++ b/Source/cmLocalVisualStudio7Generator.cxx
@@ -134,9 +134,7 @@ void cmLocalVisualStudio7Generator::OutputVCProjFile()
{
// INCLUDE_EXTERNAL_MSPROJECT command only affects the workspace
// so don't build a projectfile for it
- if ((l->second.GetType() != cmTarget::INSTALL_FILES)
- && (l->second.GetType() != cmTarget::INSTALL_PROGRAMS)
- && (strncmp(l->first.c_str(), "INCLUDE_EXTERNAL_MSPROJECT", 26) != 0))
+ if (strncmp(l->first.c_str(), "INCLUDE_EXTERNAL_MSPROJECT", 26) != 0)
{
this->CreateSingleVCProj(l->first.c_str(),l->second);
}
diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx
index 064e15388e..001f13d139 100644
--- a/Source/cmMakefile.cxx
+++ b/Source/cmMakefile.cxx
@@ -1317,8 +1317,6 @@ void cmMakefile::AddGlobalLinkInformation(const char* name, cmTarget& target)
{
case cmTarget::UTILITY:
case cmTarget::GLOBAL_TARGET:
- case cmTarget::INSTALL_FILES:
- case cmTarget::INSTALL_PROGRAMS:
return;
default:;
}
diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx
index da33e075fa..6d9b419a52 100644
--- a/Source/cmTarget.cxx
+++ b/Source/cmTarget.cxx
@@ -337,6 +337,12 @@ void cmTarget::DefineProperties(cmake *cm)
void cmTarget::SetType(TargetType type, const char* name)
{
this->Name = name;
+ if(type == cmTarget::INSTALL_FILES ||
+ type == cmTarget::INSTALL_PROGRAMS ||
+ type == cmTarget::INSTALL_DIRECTORY)
+ {
+ abort();
+ }
// only add dependency information for library targets
this->TargetTypeValue = type;
if(this->TargetTypeValue >= STATIC_LIBRARY
@@ -664,12 +670,6 @@ void cmTarget::GenerateSourceFilesFromSourceLists( cmMakefile &mf)
{
return;
}
- // this is only done for non install targets
- if ((this->TargetTypeValue == cmTarget::INSTALL_FILES)
- || (this->TargetTypeValue == cmTarget::INSTALL_PROGRAMS))
- {
- return;
- }
// for each src lists add the classes
for (std::vector<std::string>::const_iterator s = this->SourceLists.begin();
s != this->SourceLists.end(); ++s)