summaryrefslogtreecommitdiffstats
path: root/Source/cmGlobalGenerator.cxx
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2006-08-31 14:47:00 (GMT)
committerBrad King <brad.king@kitware.com>2006-08-31 14:47:00 (GMT)
commit239fce5caa59daeaea830aa38e0cb576599221da (patch)
treeff4824f735b799f55f79da7ba394d54c77d32b88 /Source/cmGlobalGenerator.cxx
parent8ffb32369fedfbbd59631bbd9472c5fb1cd462f7 (diff)
downloadCMake-239fce5caa59daeaea830aa38e0cb576599221da.zip
CMake-239fce5caa59daeaea830aa38e0cb576599221da.tar.gz
CMake-239fce5caa59daeaea830aa38e0cb576599221da.tar.bz2
ENH: Do not generate install target unless some INSTALL or INSTALL_* commands have been used. This addresses bug#2827.
Diffstat (limited to 'Source/cmGlobalGenerator.cxx')
-rw-r--r--Source/cmGlobalGenerator.cxx115
1 files changed, 63 insertions, 52 deletions
diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx
index 35bc3b7..1b72f40 100644
--- a/Source/cmGlobalGenerator.cxx
+++ b/Source/cmGlobalGenerator.cxx
@@ -42,6 +42,9 @@ cmGlobalGenerator::cmGlobalGenerator()
// Relative paths are not configured in the constructor.
this->RelativePathsConfigured = false;
+
+ // Whether an install target is needed.
+ this->InstallTargetEnabled = false;
}
cmGlobalGenerator::~cmGlobalGenerator()
@@ -927,6 +930,11 @@ void cmGlobalGenerator::AddInstallComponent(const char* component)
}
}
+void cmGlobalGenerator::EnableInstallTarget()
+{
+ this->InstallTargetEnabled = true;
+}
+
cmLocalGenerator *cmGlobalGenerator::CreateLocalGenerator()
{
cmLocalGenerator *lg = new cmLocalGenerator;
@@ -1448,66 +1456,69 @@ void cmGlobalGenerator::CreateDefaultGlobalTargets(cmTargets* targets)
}
//Install
- std::string cmd;
- cpackCommandLines.erase(cpackCommandLines.begin(), cpackCommandLines.end());
- singleLine.erase(singleLine.begin(), singleLine.end());
- depends.erase(depends.begin(), depends.end());
- if ( this->GetPreinstallTargetName() )
- {
- depends.push_back(this->GetPreinstallTargetName());
- }
- else
+ if(this->InstallTargetEnabled)
{
- const char* noall =
- mf->GetDefinition("CMAKE_SKIP_INSTALL_ALL_DEPENDENCY");
- if(!noall || cmSystemTools::IsOff(noall))
+ std::string cmd;
+ cpackCommandLines.erase(cpackCommandLines.begin(), cpackCommandLines.end());
+ singleLine.erase(singleLine.begin(), singleLine.end());
+ depends.erase(depends.begin(), depends.end());
+ if ( this->GetPreinstallTargetName() )
{
- depends.push_back(this->GetAllTargetName());
+ depends.push_back(this->GetPreinstallTargetName());
}
- }
- if(mf->GetDefinition("CMake_BINARY_DIR"))
- {
- // We are building CMake itself. We cannot use the original
- // executable to install over itself.
- cmd = mf->GetDefinition("EXECUTABLE_OUTPUT_PATH");
- if(cmakeCfgIntDir && *cmakeCfgIntDir && cmakeCfgIntDir[0] != '.')
+ else
{
- cmd += "/";
- cmd += cmakeCfgIntDir;
+ const char* noall =
+ mf->GetDefinition("CMAKE_SKIP_INSTALL_ALL_DEPENDENCY");
+ if(!noall || cmSystemTools::IsOff(noall))
+ {
+ depends.push_back(this->GetAllTargetName());
+ }
}
- cmd += "/cmake";
- }
- else
- {
- cmd = cmakeCommand;
- }
- singleLine.push_back(cmd.c_str());
- if ( cmakeCfgIntDir && *cmakeCfgIntDir && cmakeCfgIntDir[0] != '.' )
- {
- std::string cfgArg = "-DBUILD_TYPE=";
- cfgArg += mf->GetDefinition("CMAKE_CFG_INTDIR");
- singleLine.push_back(cfgArg);
- }
- singleLine.push_back("-P");
- singleLine.push_back("cmake_install.cmake");
- cpackCommandLines.push_back(singleLine);
- (*targets)[this->GetInstallTargetName()] =
- this->CreateGlobalTarget(
- this->GetInstallTargetName(), "Install the project...",
- &cpackCommandLines, depends);
-
- // install_local
- if(const char* install_local = this->GetInstallLocalTargetName())
- {
- singleLine.insert(singleLine.begin()+1, "-DCMAKE_INSTALL_LOCAL_ONLY=1");
- cpackCommandLines.erase(cpackCommandLines.begin(),
- cpackCommandLines.end());
+ if(mf->GetDefinition("CMake_BINARY_DIR"))
+ {
+ // We are building CMake itself. We cannot use the original
+ // executable to install over itself.
+ cmd = mf->GetDefinition("EXECUTABLE_OUTPUT_PATH");
+ if(cmakeCfgIntDir && *cmakeCfgIntDir && cmakeCfgIntDir[0] != '.')
+ {
+ cmd += "/";
+ cmd += cmakeCfgIntDir;
+ }
+ cmd += "/cmake";
+ }
+ else
+ {
+ cmd = cmakeCommand;
+ }
+ singleLine.push_back(cmd.c_str());
+ if ( cmakeCfgIntDir && *cmakeCfgIntDir && cmakeCfgIntDir[0] != '.' )
+ {
+ std::string cfgArg = "-DBUILD_TYPE=";
+ cfgArg += mf->GetDefinition("CMAKE_CFG_INTDIR");
+ singleLine.push_back(cfgArg);
+ }
+ singleLine.push_back("-P");
+ singleLine.push_back("cmake_install.cmake");
cpackCommandLines.push_back(singleLine);
-
- (*targets)[install_local] =
+ (*targets)[this->GetInstallTargetName()] =
this->CreateGlobalTarget(
- install_local, "Installing only the local directory...",
+ this->GetInstallTargetName(), "Install the project...",
&cpackCommandLines, depends);
+
+ // install_local
+ if(const char* install_local = this->GetInstallLocalTargetName())
+ {
+ singleLine.insert(singleLine.begin()+1, "-DCMAKE_INSTALL_LOCAL_ONLY=1");
+ cpackCommandLines.erase(cpackCommandLines.begin(),
+ cpackCommandLines.end());
+ cpackCommandLines.push_back(singleLine);
+
+ (*targets)[install_local] =
+ this->CreateGlobalTarget(
+ install_local, "Installing only the local directory...",
+ &cpackCommandLines, depends);
+ }
}
}