diff options
author | Brad King <brad.king@kitware.com> | 2006-03-04 00:29:35 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2006-03-04 00:29:35 (GMT) |
commit | 06846c4c07294ed460b0ebb2c775b385e2e6d9c9 (patch) | |
tree | b7443a5dce61fc3b5084cc17e2ed7930cc9c738b /Source | |
parent | a2e136fd17b693765a4961220433bdf207930583 (diff) | |
download | CMake-06846c4c07294ed460b0ebb2c775b385e2e6d9c9.zip CMake-06846c4c07294ed460b0ebb2c775b385e2e6d9c9.tar.gz CMake-06846c4c07294ed460b0ebb2c775b385e2e6d9c9.tar.bz2 |
ENH: Added PERMISSIONS option to the TARGETS mode of the INSTALL command.
Diffstat (limited to 'Source')
-rw-r--r-- | Source/cmInstallCommand.cxx | 56 | ||||
-rw-r--r-- | Source/cmInstallCommand.h | 1 | ||||
-rw-r--r-- | Source/cmInstallTargetGenerator.cxx | 9 | ||||
-rw-r--r-- | Source/cmInstallTargetGenerator.h | 5 |
4 files changed, 61 insertions, 10 deletions
diff --git a/Source/cmInstallCommand.cxx b/Source/cmInstallCommand.cxx index 15a0f2b..449aa44 100644 --- a/Source/cmInstallCommand.cxx +++ b/Source/cmInstallCommand.cxx @@ -98,11 +98,14 @@ bool cmInstallCommand::HandleTargetsMode(std::vector<std::string> const& args) // This is the TARGETS mode. bool doing_targets = true; bool doing_destination = false; + bool doing_permissions = false; bool library_settings = true; bool runtime_settings = true; std::vector<cmTarget*> targets; const char* library_destination = 0; const char* runtime_destination = 0; + std::string library_permissions; + std::string runtime_permissions; for(unsigned int i=1; i < args.size(); ++i) { if(args[i] == "DESTINATION") @@ -110,12 +113,21 @@ bool cmInstallCommand::HandleTargetsMode(std::vector<std::string> const& args) // Switch to setting the destination property. doing_targets = false; doing_destination = true; + doing_permissions = false; + } + else if(args[i] == "PERMISSIONS") + { + // Switch to setting the permissions property. + doing_targets = false; + doing_destination = false; + doing_permissions = true; } else if(args[i] == "LIBRARY") { // Switch to setting only library properties. doing_targets = false; doing_destination = false; + doing_permissions = false; library_settings = true; runtime_settings = false; } @@ -124,6 +136,7 @@ bool cmInstallCommand::HandleTargetsMode(std::vector<std::string> const& args) // Switch to setting only runtime properties. doing_targets = false; doing_destination = false; + doing_permissions = false; library_settings = false; runtime_settings = true; } @@ -171,6 +184,34 @@ bool cmInstallCommand::HandleTargetsMode(std::vector<std::string> const& args) } doing_destination = false; } + else if(doing_permissions) + { + // Set the permissions in the active set(s) of properties. + if(library_settings) + { + // Check the requested permission. + if(!this->CheckPermissions(args[i], library_permissions)) + { + cmOStringStream e; + e << args[0] << " given invalid permission \"" + << args[i] << "\"."; + this->SetError(e.str().c_str()); + return false; + } + } + if(runtime_settings) + { + // Check the requested permission. + if(!this->CheckPermissions(args[i], runtime_permissions)) + { + cmOStringStream e; + e << args[0] << " given invalid permission \"" + << args[i] << "\"."; + this->SetError(e.str().c_str()); + return false; + } + } + } else { // Unknown argument. @@ -218,13 +259,15 @@ bool cmInstallCommand::HandleTargetsMode(std::vector<std::string> const& args) { // The import library uses the LIBRARY properties. m_Makefile->AddInstallGenerator( - new cmInstallTargetGenerator(target, library_dest.c_str(), true)); + new cmInstallTargetGenerator(target, library_dest.c_str(), true, + library_permissions.c_str())); } if(runtime_destination) { // The DLL uses the RUNTIME properties. m_Makefile->AddInstallGenerator( - new cmInstallTargetGenerator(target, runtime_dest.c_str(), false)); + new cmInstallTargetGenerator(target, runtime_dest.c_str(), false, + runtime_permissions.c_str())); } #else // This is a non-DLL platform. @@ -232,7 +275,8 @@ bool cmInstallCommand::HandleTargetsMode(std::vector<std::string> const& args) { // The shared library uses the LIBRARY properties. m_Makefile->AddInstallGenerator( - new cmInstallTargetGenerator(target, library_dest.c_str())); + new cmInstallTargetGenerator(target, library_dest.c_str(), false, + library_permissions.c_str())); } #endif } @@ -244,7 +288,8 @@ bool cmInstallCommand::HandleTargetsMode(std::vector<std::string> const& args) if(library_destination) { m_Makefile->AddInstallGenerator( - new cmInstallTargetGenerator(target, library_dest.c_str())); + new cmInstallTargetGenerator(target, library_dest.c_str(), false, + library_permissions.c_str())); } else { @@ -270,7 +315,8 @@ bool cmInstallCommand::HandleTargetsMode(std::vector<std::string> const& args) if(runtime_destination) { m_Makefile->AddInstallGenerator( - new cmInstallTargetGenerator(target, runtime_dest.c_str())); + new cmInstallTargetGenerator(target, runtime_dest.c_str(), false, + runtime_permissions.c_str())); } else { diff --git a/Source/cmInstallCommand.h b/Source/cmInstallCommand.h index c692c22..d31fef5 100644 --- a/Source/cmInstallCommand.h +++ b/Source/cmInstallCommand.h @@ -90,6 +90,7 @@ public: "The TARGETS signature:\n" " INSTALL(TARGETS targets... [[LIBRARY|RUNTIME]\n" " [DESTINATION <dir>]\n" + " [PERMISSIONS permissions...]\n" " ] [...])\n" "The TARGETS form specifies rules for installing targets from a " "project. There are two kinds of target files that may be " diff --git a/Source/cmInstallTargetGenerator.cxx b/Source/cmInstallTargetGenerator.cxx index 6be87ec..c84c4af 100644 --- a/Source/cmInstallTargetGenerator.cxx +++ b/Source/cmInstallTargetGenerator.cxx @@ -23,8 +23,10 @@ //---------------------------------------------------------------------------- cmInstallTargetGenerator -::cmInstallTargetGenerator(cmTarget& t, const char* dest, bool implib): - Target(&t), Destination(dest), ImportLibrary(implib) +::cmInstallTargetGenerator(cmTarget& t, const char* dest, bool implib, + const char* permissions): + Target(&t), Destination(dest), ImportLibrary(implib), + Permissions(permissions) { this->Target->SetHaveInstallRule(true); } @@ -158,7 +160,8 @@ void cmInstallTargetGenerator::GenerateScript(std::ostream& os) // Write code to install the target file. this->AddInstallRule(os, destination.c_str(), type, fromFile.c_str(), - this->ImportLibrary, properties); + this->ImportLibrary, properties, + this->Permissions.c_str()); // Fix the install_name settings in installed binaries. if(type == cmTarget::SHARED_LIBRARY || diff --git a/Source/cmInstallTargetGenerator.h b/Source/cmInstallTargetGenerator.h index 8ae834b..482e3f4 100644 --- a/Source/cmInstallTargetGenerator.h +++ b/Source/cmInstallTargetGenerator.h @@ -27,8 +27,8 @@ class cmTarget; class cmInstallTargetGenerator: public cmInstallGenerator { public: - cmInstallTargetGenerator(cmTarget& t, const char* dest, - bool implib = false); + cmInstallTargetGenerator(cmTarget& t, const char* dest, bool implib, + const char* permissions = ""); virtual ~cmInstallTargetGenerator(); protected: @@ -42,6 +42,7 @@ protected: cmTarget* Target; std::string Destination; bool ImportLibrary; + std::string Permissions; }; #endif |