install(TARGETS): Add RUNTIME_DEPENDENCY_SET argument
This commit is contained in:
parent
ed3633d88c
commit
3e7d3c252a
@ -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.
|
||||
|
@ -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)
|
||||
|
@ -0,0 +1 @@
|
||||
1
|
@ -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\)$
|
@ -0,0 +1,7 @@
|
||||
enable_language(C)
|
||||
|
||||
add_executable(exe main.c)
|
||||
install(TARGETS exe
|
||||
RUNTIME_DEPENDENCY_SET deps
|
||||
RUNTIME_DEPENDENCIES
|
||||
)
|
@ -0,0 +1 @@
|
||||
1
|
@ -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\)$
|
@ -0,0 +1,4 @@
|
||||
enable_language(C)
|
||||
|
||||
add_executable(exe main.c)
|
||||
install(TARGETS exe RUNTIME_DEPENDENCY_SET deps)
|
Loading…
Reference in New Issue
Block a user