mirror of
https://github.com/Kitware/CMake.git
synced 2025-10-15 20:46:37 +08:00
install(TARGETS): Add RUNTIME_DEPENDENCY_SET argument
This commit is contained in:
@@ -413,12 +413,14 @@ bool HandleTargetsMode(std::vector<std::string> const& args,
|
|||||||
std::vector<std::string> targetList;
|
std::vector<std::string> targetList;
|
||||||
std::string exports;
|
std::string exports;
|
||||||
std::vector<std::string> runtimeDependenciesArgVector;
|
std::vector<std::string> runtimeDependenciesArgVector;
|
||||||
|
std::string runtimeDependencySetArg;
|
||||||
std::vector<std::string> unknownArgs;
|
std::vector<std::string> unknownArgs;
|
||||||
std::vector<std::string> parsedArgs;
|
std::vector<std::string> parsedArgs;
|
||||||
cmInstallCommandArguments genericArgs(helper.DefaultComponentName);
|
cmInstallCommandArguments genericArgs(helper.DefaultComponentName);
|
||||||
genericArgs.Bind("TARGETS"_s, targetList);
|
genericArgs.Bind("TARGETS"_s, targetList);
|
||||||
genericArgs.Bind("EXPORT"_s, exports);
|
genericArgs.Bind("EXPORT"_s, exports);
|
||||||
genericArgs.Bind("RUNTIME_DEPENDENCIES"_s, runtimeDependenciesArgVector);
|
genericArgs.Bind("RUNTIME_DEPENDENCIES"_s, runtimeDependenciesArgVector);
|
||||||
|
genericArgs.Bind("RUNTIME_DEPENDENCY_SET"_s, runtimeDependencySetArg);
|
||||||
genericArgs.Parse(genericArgVector, &unknownArgs, nullptr, &parsedArgs);
|
genericArgs.Parse(genericArgVector, &unknownArgs, nullptr, &parsedArgs);
|
||||||
bool success = genericArgs.Finalize();
|
bool success = genericArgs.Finalize();
|
||||||
|
|
||||||
@@ -537,6 +539,11 @@ bool HandleTargetsMode(std::vector<std::string> const& args,
|
|||||||
|
|
||||||
cmInstallRuntimeDependencySet* runtimeDependencySet = nullptr;
|
cmInstallRuntimeDependencySet* runtimeDependencySet = nullptr;
|
||||||
if (withRuntimeDependencies) {
|
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");
|
auto system = helper.Makefile->GetSafeDefinition("CMAKE_HOST_SYSTEM_NAME");
|
||||||
if (!cmRuntimeDependencyArchive::PlatformSupportsRuntimeDependencies(
|
if (!cmRuntimeDependencyArchive::PlatformSupportsRuntimeDependencies(
|
||||||
system)) {
|
system)) {
|
||||||
@@ -559,6 +566,18 @@ bool HandleTargetsMode(std::vector<std::string> const& args,
|
|||||||
}
|
}
|
||||||
runtimeDependencySet = helper.Makefile->GetGlobalGenerator()
|
runtimeDependencySet = helper.Makefile->GetGlobalGenerator()
|
||||||
->CreateAnonymousRuntimeDependencySet();
|
->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.
|
// 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}")
|
set(RunCMake_TEST_OPTIONS "-DCMAKE_SYSTEM_NAME:STRING=${CMAKE_SYSTEM_NAME}")
|
||||||
run_cmake(TARGETS-RUNTIME_DEPENDENCIES-cross)
|
run_cmake(TARGETS-RUNTIME_DEPENDENCIES-cross)
|
||||||
unset(RunCMake_TEST_OPTIONS)
|
unset(RunCMake_TEST_OPTIONS)
|
||||||
|
run_cmake(TARGETS-RUNTIME_DEPENDENCY_SET-RUNTIME_DEPENDENCIES-conflict)
|
||||||
else()
|
else()
|
||||||
run_cmake(TARGETS-RUNTIME_DEPENDENCIES-unsupported)
|
run_cmake(TARGETS-RUNTIME_DEPENDENCIES-unsupported)
|
||||||
|
run_cmake(TARGETS-RUNTIME_DEPENDENCY_SET-unsupported)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
set(run_install_test_components 1)
|
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)
|
Reference in New Issue
Block a user