[cmake-commits] king committed cmInstallCommand.cxx 1.18 1.19
cmInstallCommand.h 1.15 1.16 cmInstallFilesGenerator.cxx 1.5
1.6 cmInstallFilesGenerator.h 1.5 1.6
cmInstallTargetGenerator.cxx 1.20 1.21
cmInstallTargetGenerator.h 1.8 1.9
cmake-commits at cmake.org
cmake-commits at cmake.org
Thu Oct 5 11:31:59 EDT 2006
Update of /cvsroot/CMake/CMake/Source
In directory public:/mounts/ram/cvs-serv5603/Source
Modified Files:
cmInstallCommand.cxx cmInstallCommand.h
cmInstallFilesGenerator.cxx cmInstallFilesGenerator.h
cmInstallTargetGenerator.cxx cmInstallTargetGenerator.h
Log Message:
ENH: Added OPTIONAL option to INSTALL command to allow installation of files if they exist while ignoring them otherwise. This addresses bug#2922.
Index: cmInstallFilesGenerator.h
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmInstallFilesGenerator.h,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- cmInstallFilesGenerator.h 17 Aug 2006 18:48:54 -0000 1.5
+++ cmInstallFilesGenerator.h 5 Oct 2006 15:31:56 -0000 1.6
@@ -30,7 +30,8 @@
const char* file_permissions,
std::vector<std::string> const& configurations,
const char* component,
- const char* rename);
+ const char* rename,
+ bool optional = false);
virtual ~cmInstallFilesGenerator();
protected:
@@ -42,6 +43,7 @@
std::vector<std::string> Configurations;
std::string Component;
std::string Rename;
+ bool Optional;
};
#endif
Index: cmInstallTargetGenerator.h
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmInstallTargetGenerator.h,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -d -r1.8 -r1.9
--- cmInstallTargetGenerator.h 17 Aug 2006 18:48:54 -0000 1.8
+++ cmInstallTargetGenerator.h 5 Oct 2006 15:31:56 -0000 1.9
@@ -32,7 +32,8 @@
const char* file_permissions = "",
std::vector<std::string> const& configurations
= std::vector<std::string>(),
- const char* component = ""
+ const char* component = "",
+ bool optional = false
);
virtual ~cmInstallTargetGenerator();
@@ -50,6 +51,7 @@
std::string FilePermissions;
std::vector<std::string> Configurations;
std::string Component;
+ bool Optional;
};
#endif
Index: cmInstallFilesGenerator.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmInstallFilesGenerator.cxx,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- cmInstallFilesGenerator.cxx 17 Aug 2006 18:48:54 -0000 1.5
+++ cmInstallFilesGenerator.cxx 5 Oct 2006 15:31:56 -0000 1.6
@@ -25,10 +25,11 @@
const char* file_permissions,
std::vector<std::string> const& configurations,
const char* component,
- const char* rename):
+ const char* rename,
+ bool optional):
Files(files), Destination(dest), Programs(programs),
FilePermissions(file_permissions), Configurations(configurations),
- Component(component), Rename(rename)
+ Component(component), Rename(rename), Optional(optional)
{
}
@@ -45,14 +46,13 @@
for(std::vector<std::string>::const_iterator fi = this->Files.begin();
fi != this->Files.end(); ++fi)
{
- bool not_optional = false;
const char* no_properties = 0;
const char* no_dir_permissions = 0;
this->AddInstallRule(os, this->Destination.c_str(),
(this->Programs
? cmTarget::INSTALL_PROGRAMS
: cmTarget::INSTALL_FILES), fi->c_str(),
- not_optional, no_properties,
+ this->Optional, no_properties,
this->FilePermissions.c_str(), no_dir_permissions,
this->Configurations,
this->Component.c_str(),
Index: cmInstallCommand.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmInstallCommand.cxx,v
retrieving revision 1.18
retrieving revision 1.19
diff -u -d -r1.18 -r1.19
--- cmInstallCommand.cxx 8 Sep 2006 14:39:51 -0000 1.18
+++ cmInstallCommand.cxx 5 Oct 2006 15:31:56 -0000 1.19
@@ -151,6 +151,9 @@
std::vector<std::string> archive_configurations;
std::vector<std::string> library_configurations;
std::vector<std::string> runtime_configurations;
+ bool archive_optional = false;
+ bool library_optional = false;
+ bool runtime_optional = false;
for(unsigned int i=1; i < args.size(); ++i)
{
if(args[i] == "DESTINATION")
@@ -225,6 +228,27 @@
library_settings = false;
runtime_settings = true;
}
+ else if(args[i] == "OPTIONAL")
+ {
+ // Set the optional property.
+ doing_targets = false;
+ doing_destination = false;
+ doing_permissions = false;
+ doing_component = false;
+ doing_configurations = false;
+ if(archive_settings)
+ {
+ archive_optional = true;
+ }
+ if(library_settings)
+ {
+ library_optional = true;
+ }
+ if(runtime_settings)
+ {
+ runtime_optional = true;
+ }
+ }
else if(doing_targets)
{
// Lookup this target in the current directory.
@@ -404,7 +428,8 @@
new cmInstallTargetGenerator(target, archive_dest.c_str(), true,
archive_permissions.c_str(),
archive_configurations,
- archive_component.c_str()));
+ archive_component.c_str(),
+ archive_optional));
}
if(runtime_destination)
{
@@ -414,7 +439,8 @@
false,
runtime_permissions.c_str(),
runtime_configurations,
- runtime_component.c_str()));
+ runtime_component.c_str(),
+ runtime_optional));
}
}
else
@@ -428,7 +454,8 @@
false,
library_permissions.c_str(),
library_configurations,
- library_component.c_str()));
+ library_component.c_str(),
+ library_optional));
}
else
{
@@ -450,7 +477,8 @@
new cmInstallTargetGenerator(target, archive_dest.c_str(), false,
archive_permissions.c_str(),
archive_configurations,
- archive_component.c_str()));
+ archive_component.c_str(),
+ archive_optional));
}
else
{
@@ -471,7 +499,8 @@
new cmInstallTargetGenerator(target, library_dest.c_str(), false,
library_permissions.c_str(),
library_configurations,
- library_component.c_str()));
+ library_component.c_str(),
+ library_optional));
}
else
{
@@ -492,7 +521,8 @@
new cmInstallTargetGenerator(target, runtime_dest.c_str(), false,
runtime_permissions.c_str(),
runtime_configurations,
- runtime_component.c_str()));
+ runtime_component.c_str(),
+ runtime_optional));
}
else
{
@@ -540,6 +570,7 @@
std::string permissions;
std::vector<std::string> configurations;
std::string component;
+ bool optional = false;
for(unsigned int i=1; i < args.size(); ++i)
{
if(args[i] == "DESTINATION")
@@ -592,6 +623,17 @@
doing_component = false;
doing_rename = true;
}
+ else if(args[i] == "OPTIONAL")
+ {
+ // Set the optional property.
+ doing_files = false;
+ doing_destination = false;
+ doing_permissions = false;
+ doing_configurations = false;
+ doing_component = false;
+ doing_rename = false;
+ optional = true;
+ }
else if(doing_files)
{
// Convert this file to a full path.
@@ -686,7 +728,8 @@
this->Makefile->AddInstallGenerator(
new cmInstallFilesGenerator(files, dest.c_str(), programs,
permissions.c_str(), configurations,
- component.c_str(), rename.c_str()));
+ component.c_str(), rename.c_str(),
+ optional));
// Tell the global generator about any installation component names
// specified.
Index: cmInstallTargetGenerator.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmInstallTargetGenerator.cxx,v
retrieving revision 1.20
retrieving revision 1.21
diff -u -d -r1.20 -r1.21
--- cmInstallTargetGenerator.cxx 21 Aug 2006 20:55:03 -0000 1.20
+++ cmInstallTargetGenerator.cxx 5 Oct 2006 15:31:56 -0000 1.21
@@ -27,10 +27,10 @@
::cmInstallTargetGenerator(cmTarget& t, const char* dest, bool implib,
const char* file_permissions,
std::vector<std::string> const& configurations,
- const char* component):
+ const char* component, bool optional):
Target(&t), Destination(dest), ImportLibrary(implib),
FilePermissions(file_permissions), Configurations(configurations),
- Component(component)
+ Component(component), Optional(optional)
{
this->Target->SetHaveInstallRule(true);
}
@@ -162,8 +162,9 @@
// Write code to install the target file.
const char* no_dir_permissions = 0;
const char* no_rename = 0;
+ bool optional = this->Optional | this->ImportLibrary;
this->AddInstallRule(os, destination.c_str(), type, fromFile.c_str(),
- this->ImportLibrary, properties,
+ optional, properties,
this->FilePermissions.c_str(), no_dir_permissions,
this->Configurations,
this->Component.c_str(),
Index: cmInstallCommand.h
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmInstallCommand.h,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -d -r1.15 -r1.16
--- cmInstallCommand.h 29 Aug 2006 19:08:31 -0000 1.15
+++ cmInstallCommand.h 5 Oct 2006 15:31:56 -0000 1.16
@@ -93,6 +93,8 @@
"The RENAME argument specifies a name for an installed file that "
"may be different from the original file. Renaming is allowed only "
"when a single file is installed by the command. "
+ "The OPTIONAL argument specifies that it is not an error if the "
+ "file to be installed does not exist. "
"\n"
"The TARGETS signature:\n"
" INSTALL(TARGETS targets...\n"
@@ -101,6 +103,7 @@
" [PERMISSIONS permissions...]\n"
" [CONFIGURATIONS [Debug|Release|...]]\n"
" [COMPONENT <component>]\n"
+ " [OPTIONAL]\n"
" ] [...])\n"
"The TARGETS form specifies rules for installing targets from a "
"project. There are three kinds of target files that may be "
@@ -146,7 +149,7 @@
" [PERMISSIONS permissions...]\n"
" [CONFIGURATIONS [Debug|Release|...]]\n"
" [COMPONENT <component>]\n"
- " [RENAME <name>])\n"
+ " [RENAME <name>] [OPTIONAL])\n"
"The FILES form specifies rules for installing files for a "
"project. File names given as relative paths are interpreted with "
"respect to the current source directory. Files installed by this "
@@ -158,7 +161,7 @@
" [PERMISSIONS permissions...]\n"
" [CONFIGURATIONS [Debug|Release|...]]\n"
" [COMPONENT <component>]\n"
- " [RENAME <name>])\n"
+ " [RENAME <name>] [OPTIONAL])\n"
"The PROGRAMS form is identical to the FILES form except that the "
"default permissions for the installed file also include "
"OWNER_EXECUTE, GROUP_EXECUTE, and WORLD_EXECUTE. "
More information about the Cmake-commits
mailing list