ENH: Adding install/local global target for Makefile generators. This runs installation only in the current directory and not subdirectories.

This commit is contained in:
Brad King 2006-08-29 10:03:47 -04:00
parent 8a761b8f96
commit eef327b944
5 changed files with 21 additions and 3 deletions

View File

@ -1495,6 +1495,20 @@ void cmGlobalGenerator::CreateDefaultGlobalTargets(cmTargets* targets)
this->CreateGlobalTarget( this->CreateGlobalTarget(
this->GetInstallTargetName(), "Install the project...", this->GetInstallTargetName(), "Install the project...",
&cpackCommandLines, depends); &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);
}
} }
cmTarget cmGlobalGenerator::CreateGlobalTarget( cmTarget cmGlobalGenerator::CreateGlobalTarget(

View File

@ -186,6 +186,7 @@ public:
virtual const char* GetAllTargetName() { return "ALL_BUILD"; } virtual const char* GetAllTargetName() { return "ALL_BUILD"; }
virtual const char* GetInstallTargetName() { return "INSTALL"; } virtual const char* GetInstallTargetName() { return "INSTALL"; }
virtual const char* GetInstallLocalTargetName() { return 0; }
virtual const char* GetPreinstallTargetName() { return 0; } virtual const char* GetPreinstallTargetName() { return 0; }
virtual const char* GetTestTargetName() { return "RUN_TESTS"; } virtual const char* GetTestTargetName() { return "RUN_TESTS"; }
virtual const char* GetPackageTargetName() { return "PACKAGE"; } virtual const char* GetPackageTargetName() { return "PACKAGE"; }

View File

@ -159,6 +159,7 @@ protected:
// Setup target names // Setup target names
virtual const char* GetAllTargetName() { return "all"; } virtual const char* GetAllTargetName() { return "all"; }
virtual const char* GetInstallTargetName() { return "install"; } virtual const char* GetInstallTargetName() { return "install"; }
virtual const char* GetInstallLocalTargetName() { return "install/local"; }
virtual const char* GetPreinstallTargetName() { return "preinstall"; } virtual const char* GetPreinstallTargetName() { return "preinstall"; }
virtual const char* GetTestTargetName() { return "test"; } virtual const char* GetTestTargetName() { return "test"; }
virtual const char* GetPackageTargetName() { return "package"; } virtual const char* GetPackageTargetName() { return "package"; }

View File

@ -397,6 +397,7 @@ void cmLocalGenerator::GenerateInstallRules()
// Include install scripts from subdirectories. // Include install scripts from subdirectories.
if(!this->Children.empty()) if(!this->Children.empty())
{ {
fout << "IF(NOT CMAKE_INSTALL_LOCAL_ONLY)\n";
fout << " # Include the install script for each subdirectory.\n"; fout << " # Include the install script for each subdirectory.\n";
for(std::vector<cmLocalGenerator*>::const_iterator for(std::vector<cmLocalGenerator*>::const_iterator
ci = this->Children.begin(); ci != this->Children.end(); ++ci) ci = this->Children.begin(); ci != this->Children.end(); ++ci)
@ -410,6 +411,7 @@ void cmLocalGenerator::GenerateInstallRules()
} }
} }
fout << "\n"; fout << "\n";
fout << "ENDIF(NOT CMAKE_INSTALL_LOCAL_ONLY)\n";
} }
// Record the install manifest. // Record the install manifest.

View File

@ -1481,7 +1481,7 @@ void cmLocalUnixMakefileGenerator3
// Provide a "/fast" version of the target. // Provide a "/fast" version of the target.
depends.clear(); depends.clear();
if(targetName == "install") if((targetName == "install") || (targetName == "install_local"))
{ {
// Provide a fast install target that does not depend on all // Provide a fast install target that does not depend on all
// but has the same command. // but has the same command.