summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKyle Edwards <kyle.edwards@kitware.com>2021-05-19 17:36:30 (GMT)
committerKyle Edwards <kyle.edwards@kitware.com>2021-06-04 12:52:02 (GMT)
commit3e7d3c252a5638d66dbbe536be79d6ed3e0e288d (patch)
treeae1d1d05c642b59871e7fdce98fdee6235a34d6f
parented3633d88cc5faa6fd7eb68fdd774d6d1f9cfdc9 (diff)
downloadCMake-3e7d3c252a5638d66dbbe536be79d6ed3e0e288d.zip
CMake-3e7d3c252a5638d66dbbe536be79d6ed3e0e288d.tar.gz
CMake-3e7d3c252a5638d66dbbe536be79d6ed3e0e288d.tar.bz2
install(TARGETS): Add RUNTIME_DEPENDENCY_SET argument
-rw-r--r--Source/cmInstallCommand.cxx19
-rw-r--r--Tests/RunCMake/install/RunCMakeTest.cmake2
-rw-r--r--Tests/RunCMake/install/TARGETS-RUNTIME_DEPENDENCY_SET-RUNTIME_DEPENDENCIES-conflict-result.txt1
-rw-r--r--Tests/RunCMake/install/TARGETS-RUNTIME_DEPENDENCY_SET-RUNTIME_DEPENDENCIES-conflict-stderr.txt5
-rw-r--r--Tests/RunCMake/install/TARGETS-RUNTIME_DEPENDENCY_SET-RUNTIME_DEPENDENCIES-conflict.cmake7
-rw-r--r--Tests/RunCMake/install/TARGETS-RUNTIME_DEPENDENCY_SET-unsupported-result.txt1
-rw-r--r--Tests/RunCMake/install/TARGETS-RUNTIME_DEPENDENCY_SET-unsupported-stderr.txt5
-rw-r--r--Tests/RunCMake/install/TARGETS-RUNTIME_DEPENDENCY_SET-unsupported.cmake4
8 files changed, 44 insertions, 0 deletions
diff --git a/Source/cmInstallCommand.cxx b/Source/cmInstallCommand.cxx
index c36778d..5d5a5a6 100644
--- a/Source/cmInstallCommand.cxx
+++ b/Source/cmInstallCommand.cxx
@@ -413,12 +413,14 @@ bool HandleTargetsMode(std::vector<std::string> const& args,
std::vector<std::string> targetList;
std::string exports;
std::vector<std::string> runtimeDependenciesArgVector;
+ std::string runtimeDependencySetArg;
std::vector<std::string> unknownArgs;
std::vector<std::string> parsedArgs;
cmInstallCommandArguments genericArgs(helper.DefaultComponentName);
genericArgs.Bind("TARGETS"_s, targetList);
genericArgs.Bind("EXPORT"_s, exports);
genericArgs.Bind("RUNTIME_DEPENDENCIES"_s, runtimeDependenciesArgVector);
+ genericArgs.Bind("RUNTIME_DEPENDENCY_SET"_s, runtimeDependencySetArg);
genericArgs.Parse(genericArgVector, &unknownArgs, nullptr, &parsedArgs);
bool success = genericArgs.Finalize();
@@ -537,6 +539,11 @@ bool HandleTargetsMode(std::vector<std::string> const& args,
cmInstallRuntimeDependencySet* runtimeDependencySet = nullptr;
if (withRuntimeDependencies) {
+ if (!runtimeDependencySetArg.empty()) {
+ status.SetError("TARGETS cannot have both RUNTIME_DEPENDENCIES and "
+ "RUNTIME_DEPENDENCY_SET.");
+ return false;
+ }
auto system = helper.Makefile->GetSafeDefinition("CMAKE_HOST_SYSTEM_NAME");
if (!cmRuntimeDependencyArchive::PlatformSupportsRuntimeDependencies(
system)) {
@@ -559,6 +566,18 @@ bool HandleTargetsMode(std::vector<std::string> const& args,
}
runtimeDependencySet = helper.Makefile->GetGlobalGenerator()
->CreateAnonymousRuntimeDependencySet();
+ } else if (!runtimeDependencySetArg.empty()) {
+ auto system = helper.Makefile->GetSafeDefinition("CMAKE_HOST_SYSTEM_NAME");
+ if (!cmRuntimeDependencyArchive::PlatformSupportsRuntimeDependencies(
+ system)) {
+ status.SetError(cmStrCat(
+ "TARGETS RUNTIME_DEPENDENCY_SET is not supported on system \"", system,
+ '"'));
+ return false;
+ }
+ runtimeDependencySet =
+ helper.Makefile->GetGlobalGenerator()->GetNamedRuntimeDependencySet(
+ runtimeDependencySetArg);
}
// Select the mode for installing symlinks to versioned shared libraries.
diff --git a/Tests/RunCMake/install/RunCMakeTest.cmake b/Tests/RunCMake/install/RunCMakeTest.cmake
index 0f6ec70..bfd01ac 100644
--- a/Tests/RunCMake/install/RunCMakeTest.cmake
+++ b/Tests/RunCMake/install/RunCMakeTest.cmake
@@ -185,8 +185,10 @@ if(CMAKE_SYSTEM_NAME MATCHES "^(Linux|Darwin|Windows)$")
set(RunCMake_TEST_OPTIONS "-DCMAKE_SYSTEM_NAME:STRING=${CMAKE_SYSTEM_NAME}")
run_cmake(TARGETS-RUNTIME_DEPENDENCIES-cross)
unset(RunCMake_TEST_OPTIONS)
+ run_cmake(TARGETS-RUNTIME_DEPENDENCY_SET-RUNTIME_DEPENDENCIES-conflict)
else()
run_cmake(TARGETS-RUNTIME_DEPENDENCIES-unsupported)
+ run_cmake(TARGETS-RUNTIME_DEPENDENCY_SET-unsupported)
endif()
set(run_install_test_components 1)
diff --git a/Tests/RunCMake/install/TARGETS-RUNTIME_DEPENDENCY_SET-RUNTIME_DEPENDENCIES-conflict-result.txt b/Tests/RunCMake/install/TARGETS-RUNTIME_DEPENDENCY_SET-RUNTIME_DEPENDENCIES-conflict-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/install/TARGETS-RUNTIME_DEPENDENCY_SET-RUNTIME_DEPENDENCIES-conflict-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/install/TARGETS-RUNTIME_DEPENDENCY_SET-RUNTIME_DEPENDENCIES-conflict-stderr.txt b/Tests/RunCMake/install/TARGETS-RUNTIME_DEPENDENCY_SET-RUNTIME_DEPENDENCIES-conflict-stderr.txt
new file mode 100644
index 0000000..e2484ec
--- /dev/null
+++ b/Tests/RunCMake/install/TARGETS-RUNTIME_DEPENDENCY_SET-RUNTIME_DEPENDENCIES-conflict-stderr.txt
@@ -0,0 +1,5 @@
+^CMake Error at TARGETS-RUNTIME_DEPENDENCY_SET-RUNTIME_DEPENDENCIES-conflict\.cmake:[0-9]+ \(install\):
+ install TARGETS cannot have both RUNTIME_DEPENDENCIES and
+ RUNTIME_DEPENDENCY_SET\.
+Call Stack \(most recent call first\):
+ CMakeLists\.txt:[0-9]+ \(include\)$
diff --git a/Tests/RunCMake/install/TARGETS-RUNTIME_DEPENDENCY_SET-RUNTIME_DEPENDENCIES-conflict.cmake b/Tests/RunCMake/install/TARGETS-RUNTIME_DEPENDENCY_SET-RUNTIME_DEPENDENCIES-conflict.cmake
new file mode 100644
index 0000000..f373b3b
--- /dev/null
+++ b/Tests/RunCMake/install/TARGETS-RUNTIME_DEPENDENCY_SET-RUNTIME_DEPENDENCIES-conflict.cmake
@@ -0,0 +1,7 @@
+enable_language(C)
+
+add_executable(exe main.c)
+install(TARGETS exe
+ RUNTIME_DEPENDENCY_SET deps
+ RUNTIME_DEPENDENCIES
+ )
diff --git a/Tests/RunCMake/install/TARGETS-RUNTIME_DEPENDENCY_SET-unsupported-result.txt b/Tests/RunCMake/install/TARGETS-RUNTIME_DEPENDENCY_SET-unsupported-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/install/TARGETS-RUNTIME_DEPENDENCY_SET-unsupported-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/install/TARGETS-RUNTIME_DEPENDENCY_SET-unsupported-stderr.txt b/Tests/RunCMake/install/TARGETS-RUNTIME_DEPENDENCY_SET-unsupported-stderr.txt
new file mode 100644
index 0000000..f660346
--- /dev/null
+++ b/Tests/RunCMake/install/TARGETS-RUNTIME_DEPENDENCY_SET-unsupported-stderr.txt
@@ -0,0 +1,5 @@
+^CMake Error at TARGETS-RUNTIME_DEPENDENCY_SET-unsupported\.cmake:[0-9]+ \(install\):
+ install TARGETS RUNTIME_DEPENDENCY_SET is not supported on system "[^
+]*"
+Call Stack \(most recent call first\):
+ CMakeLists\.txt:[0-9]+ \(include\)$
diff --git a/Tests/RunCMake/install/TARGETS-RUNTIME_DEPENDENCY_SET-unsupported.cmake b/Tests/RunCMake/install/TARGETS-RUNTIME_DEPENDENCY_SET-unsupported.cmake
new file mode 100644
index 0000000..be0f507
--- /dev/null
+++ b/Tests/RunCMake/install/TARGETS-RUNTIME_DEPENDENCY_SET-unsupported.cmake
@@ -0,0 +1,4 @@
+enable_language(C)
+
+add_executable(exe main.c)
+install(TARGETS exe RUNTIME_DEPENDENCY_SET deps)