summaryrefslogtreecommitdiffstats
path: root/Source/cmInstallGenerator.cxx
diff options
context:
space:
mode:
authorKyle Edwards <kyle.edwards@kitware.com>2021-04-14 14:43:30 (GMT)
committerKyle Edwards <kyle.edwards@kitware.com>2021-06-04 12:52:02 (GMT)
commited3633d88cc5faa6fd7eb68fdd774d6d1f9cfdc9 (patch)
treeb99345e45c9645c178601669ecd5d13c18b8ab1e /Source/cmInstallGenerator.cxx
parentf2617cf8e6aca6ec0f8c7df6999c1f713c6d7474 (diff)
downloadCMake-ed3633d88cc5faa6fd7eb68fdd774d6d1f9cfdc9.zip
CMake-ed3633d88cc5faa6fd7eb68fdd774d6d1f9cfdc9.tar.gz
CMake-ed3633d88cc5faa6fd7eb68fdd774d6d1f9cfdc9.tar.bz2
install(TARGETS): Add RUNTIME_DEPENDENCIES option
Diffstat (limited to 'Source/cmInstallGenerator.cxx')
-rw-r--r--Source/cmInstallGenerator.cxx51
1 files changed, 32 insertions, 19 deletions
diff --git a/Source/cmInstallGenerator.cxx b/Source/cmInstallGenerator.cxx
index 9f0d119..4cfeb47 100644
--- a/Source/cmInstallGenerator.cxx
+++ b/Source/cmInstallGenerator.cxx
@@ -43,7 +43,8 @@ void cmInstallGenerator::AddInstallRule(
std::vector<std::string> const& files, bool optional /* = false */,
const char* permissions_file /* = 0 */,
const char* permissions_dir /* = 0 */, const char* rename /* = 0 */,
- const char* literal_args /* = 0 */, Indent indent)
+ const char* literal_args /* = 0 */, Indent indent,
+ const char* files_var /* = 0 */)
{
// Use the FILE command to install the file.
std::string stype;
@@ -70,37 +71,46 @@ void cmInstallGenerator::AddInstallRule(
stype = "FILE";
break;
}
- os << indent;
if (cmSystemTools::FileIsFullPath(dest)) {
- os << "list(APPEND CMAKE_ABSOLUTE_DESTINATION_FILES\n";
- os << indent << " \"";
- bool firstIteration = true;
- for (std::string const& file : files) {
- if (!firstIteration) {
- os << ";";
+ if (!files.empty()) {
+ os << indent << "list(APPEND CMAKE_ABSOLUTE_DESTINATION_FILES\n";
+ os << indent << " \"";
+ bool firstIteration = true;
+ for (std::string const& file : files) {
+ if (!firstIteration) {
+ os << ";";
+ }
+ os << dest << "/";
+ if (rename && *rename) {
+ os << rename;
+ } else {
+ os << cmSystemTools::GetFilenameName(file);
+ }
+ firstIteration = false;
}
- os << dest << "/";
- if (rename && *rename) {
- os << rename;
- } else {
- os << cmSystemTools::GetFilenameName(file);
- }
- firstIteration = false;
+ os << "\")\n";
+ }
+ if (files_var) {
+ os << indent << "foreach(_f IN LISTS " << files_var << ")\n";
+ os << indent.Next() << "get_filename_component(_fn \"${_f}\" NAME)\n";
+ os << indent.Next() << "list(APPEND CMAKE_ABSOLUTE_DESTINATION_FILES \""
+ << dest << "/${_fn}\")\n";
+ os << indent << "endforeach()\n";
}
- os << "\")\n";
os << indent << "if(CMAKE_WARN_ON_ABSOLUTE_INSTALL_DESTINATION)\n";
- os << indent << indent << "message(WARNING \"ABSOLUTE path INSTALL "
+ os << indent.Next() << "message(WARNING \"ABSOLUTE path INSTALL "
<< "DESTINATION : ${CMAKE_ABSOLUTE_DESTINATION_FILES}\")\n";
os << indent << "endif()\n";
os << indent << "if(CMAKE_ERROR_ON_ABSOLUTE_INSTALL_DESTINATION)\n";
- os << indent << indent << "message(FATAL_ERROR \"ABSOLUTE path INSTALL "
+ os << indent.Next() << "message(FATAL_ERROR \"ABSOLUTE path INSTALL "
<< "DESTINATION forbidden (by caller): "
<< "${CMAKE_ABSOLUTE_DESTINATION_FILES}\")\n";
os << indent << "endif()\n";
}
std::string absDest = ConvertToAbsoluteDestination(dest);
- os << "file(INSTALL DESTINATION \"" << absDest << "\" TYPE " << stype;
+ os << indent << "file(INSTALL DESTINATION \"" << absDest << "\" TYPE "
+ << stype;
if (optional) {
os << " OPTIONAL";
}
@@ -133,6 +143,9 @@ void cmInstallGenerator::AddInstallRule(
for (std::string const& f : files) {
os << "\n" << indent << " \"" << f << "\"";
}
+ if (files_var) {
+ os << " ${" << files_var << "}";
+ }
os << "\n" << indent << " ";
if (!(literal_args && *literal_args)) {
os << " ";