summaryrefslogtreecommitdiffstats
path: root/Tests
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2021-06-08 12:08:57 (GMT)
committerKitware Robot <kwrobot@kitware.com>2021-06-08 12:09:04 (GMT)
commitacb25d50d9d37e93cafcbbc4401e1b45029b6461 (patch)
tree078d3f511f584e4f924a9380f9539aa122a2263e /Tests
parent3653dc60690e6fc33d9e7bf44186b82587cf21a7 (diff)
parent8d898cb3e10d6ad44bbe542b7b219a0b788b2a0d (diff)
downloadCMake-acb25d50d9d37e93cafcbbc4401e1b45029b6461.zip
CMake-acb25d50d9d37e93cafcbbc4401e1b45029b6461.tar.gz
CMake-acb25d50d9d37e93cafcbbc4401e1b45029b6461.tar.bz2
Merge topic 'install-with-runtime-dependencies'
8d898cb3e1 FileAPI: Add integration for runtime dependency installers 72f2448e82 Help: Add documentation for runtime dependency installation 0c3c6acaff Tests: Add tests for new options 4910132d8c install: Add RUNTIME_DEPENDENCY_SET mode bc8a4a06a4 install(IMPORTED_RUNTIME_ARTIFACTS): Add RUNTIME_DEPENDENCY_SET option 3e7d3c252a install(TARGETS): Add RUNTIME_DEPENDENCY_SET argument ed3633d88c install(TARGETS): Add RUNTIME_DEPENDENCIES option f2617cf8e6 Source: Add cmInstallRuntimeDependencySet ... Acked-by: Kitware Robot <kwrobot@kitware.com> Merge-request: !6186
Diffstat (limited to 'Tests')
-rw-r--r--Tests/CMakeLists.txt1
-rw-r--r--Tests/ExportImport/CMakeLists.txt36
-rw-r--r--Tests/ExportImport/Export/CMakeLists.txt2
-rw-r--r--Tests/ExportImport/Export/install-RUNTIME_DEPENDENCY_SET/CMakeLists.txt42
-rw-r--r--Tests/ExportImport/Export/install-RUNTIME_DEPENDENCY_SET/deplib.c12
-rw-r--r--Tests/ExportImport/Import/CMakeLists.txt6
-rw-r--r--Tests/ExportImport/Import/check_installed.cmake20
-rw-r--r--Tests/ExportImport/Import/install-IMPORTED_RUNTIME_ARTIFACTS/check_installed.cmake21
-rw-r--r--Tests/ExportImport/Import/install-RUNTIME_DEPENDENCIES/CMakeLists.txt74
-rw-r--r--Tests/ExportImport/Import/install-RUNTIME_DEPENDENCIES/check_installed.cmake11
-rw-r--r--Tests/ExportImport/Import/install-RUNTIME_DEPENDENCIES/lib.c12
-rw-r--r--Tests/ExportImport/Import/install-RUNTIME_DEPENDENCIES/main.c31
-rw-r--r--Tests/ExportImport/Import/install-RUNTIME_DEPENDENCIES/mod.c12
-rw-r--r--Tests/ExportImport/Import/install-RUNTIME_DEPENDENCIES/sublib1.c12
-rw-r--r--Tests/ExportImport/Import/install-RUNTIME_DEPENDENCIES/sublib2.c12
-rw-r--r--Tests/ExportImport/Import/install-RUNTIME_DEPENDENCY_SET/CMakeLists.txt33
-rw-r--r--Tests/ExportImport/Import/install-RUNTIME_DEPENDENCY_SET/check_installed.cmake11
-rw-r--r--Tests/ExportImport/Import/install-RUNTIME_DEPENDENCY_SET/main.c15
-rw-r--r--Tests/RunCMake/FileAPI/codemodel-v2-check.py16
-rw-r--r--Tests/RunCMake/FileAPI/codemodel-v2-data/directories/cxx.json163
-rw-r--r--Tests/RunCMake/FileAPI/codemodel-v2-data/targets/cxx_exe.json17
-rw-r--r--Tests/RunCMake/FileAPI/cxx/CMakeLists.txt15
-rw-r--r--Tests/RunCMake/file-GET_RUNTIME_DEPENDENCIES/RunCMakeTest.cmake1
-rw-r--r--Tests/RunCMake/file-GET_RUNTIME_DEPENDENCIES/macos-rpath.cmake35
-rw-r--r--Tests/RunCMake/file-RPATH/Common.cmake37
-rw-r--r--Tests/RunCMake/install/IMPORTED_RUNTIME_ARTIFACTS-RUNTIME_DEPENDENCY_SET-unsupported-result.txt1
-rw-r--r--Tests/RunCMake/install/IMPORTED_RUNTIME_ARTIFACTS-RUNTIME_DEPENDENCY_SET-unsupported-stderr.txt6
-rw-r--r--Tests/RunCMake/install/IMPORTED_RUNTIME_ARTIFACTS-RUNTIME_DEPENDENCY_SET-unsupported.cmake2
-rw-r--r--Tests/RunCMake/install/RUNTIME_DEPENDENCY_SET-unsupported-result.txt1
-rw-r--r--Tests/RunCMake/install/RUNTIME_DEPENDENCY_SET-unsupported-stderr.txt5
-rw-r--r--Tests/RunCMake/install/RUNTIME_DEPENDENCY_SET-unsupported.cmake1
-rw-r--r--Tests/RunCMake/install/RunCMakeTest.cmake22
-rw-r--r--Tests/RunCMake/install/RuntimeDependencies-COMPONENTS.cmake39
-rw-r--r--Tests/RunCMake/install/TARGETS-RUNTIME_DEPENDENCIES-cross-result.txt1
-rw-r--r--Tests/RunCMake/install/TARGETS-RUNTIME_DEPENDENCIES-cross-stderr.txt4
-rw-r--r--Tests/RunCMake/install/TARGETS-RUNTIME_DEPENDENCIES-cross.cmake4
-rw-r--r--Tests/RunCMake/install/TARGETS-RUNTIME_DEPENDENCIES-empty-all-check.cmake1
-rw-r--r--Tests/RunCMake/install/TARGETS-RUNTIME_DEPENDENCIES-empty.cmake9
-rw-r--r--Tests/RunCMake/install/TARGETS-RUNTIME_DEPENDENCIES-macos-no-framework-result.txt1
-rw-r--r--Tests/RunCMake/install/TARGETS-RUNTIME_DEPENDENCIES-macos-no-framework-stderr.txt4
-rw-r--r--Tests/RunCMake/install/TARGETS-RUNTIME_DEPENDENCIES-macos-no-framework.cmake4
-rw-r--r--Tests/RunCMake/install/TARGETS-RUNTIME_DEPENDENCIES-macos-two-bundle-result.txt1
-rw-r--r--Tests/RunCMake/install/TARGETS-RUNTIME_DEPENDENCIES-macos-two-bundle-stderr.txt4
-rw-r--r--Tests/RunCMake/install/TARGETS-RUNTIME_DEPENDENCIES-macos-two-bundle.cmake10
-rw-r--r--Tests/RunCMake/install/TARGETS-RUNTIME_DEPENDENCIES-nodep-all-check.cmake1
-rw-r--r--Tests/RunCMake/install/TARGETS-RUNTIME_DEPENDENCIES-nodep.cmake9
-rw-r--r--Tests/RunCMake/install/TARGETS-RUNTIME_DEPENDENCIES-unsupported-result.txt1
-rw-r--r--Tests/RunCMake/install/TARGETS-RUNTIME_DEPENDENCIES-unsupported-stderr.txt5
-rw-r--r--Tests/RunCMake/install/TARGETS-RUNTIME_DEPENDENCIES-unsupported.cmake4
-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
55 files changed, 773 insertions, 37 deletions
diff --git a/Tests/CMakeLists.txt b/Tests/CMakeLists.txt
index 331f637..fccf15b 100644
--- a/Tests/CMakeLists.txt
+++ b/Tests/CMakeLists.txt
@@ -478,6 +478,7 @@ if(BUILD_TESTING)
ADD_TEST_MACRO(Preprocess Preprocess)
set(ExportImport_BUILD_OPTIONS -DCMake_TEST_NESTED_MAKE_PROGRAM:FILEPATH=${CMake_TEST_EXPLICIT_MAKE_PROGRAM}
-DCMake_TEST_CUDA:BOOL=${CMake_TEST_CUDA}
+ -DCMake_INSTALL_NAME_TOOL_BUG:BOOL=${CMake_INSTALL_NAME_TOOL_BUG}
)
ADD_TEST_MACRO(ExportImport ExportImport)
set_property(TEST ExportImport APPEND
diff --git a/Tests/ExportImport/CMakeLists.txt b/Tests/ExportImport/CMakeLists.txt
index 4999612..e3f32c2 100644
--- a/Tests/ExportImport/CMakeLists.txt
+++ b/Tests/ExportImport/CMakeLists.txt
@@ -77,21 +77,29 @@ set_property(
PROPERTY SYMBOLIC 1
)
-# Install the imported targets.
-add_custom_command(
- OUTPUT ${ExportImport_BINARY_DIR}/ImportInstall
- COMMAND ${CMAKE_COMMAND} -E rm -rf ${ExportImport_BINARY_DIR}/Import/install
- COMMAND ${CMAKE_COMMAND}
- --install ${ExportImport_BINARY_DIR}/Import
- --prefix ${ExportImport_BINARY_DIR}/Import/install
- ${NESTED_CONFIG_INSTALL_TYPE}
- )
-add_custom_target(ImportInstallTarget ALL DEPENDS ${ExportImport_BINARY_DIR}/ImportInstall)
+# Run the install tests.
+set(install_deps)
+set(rdep_tests)
+if(CMAKE_SYSTEM_NAME MATCHES "^(Linux|Windows|Darwin)$" AND NOT CMake_INSTALL_NAME_TOOL_BUG)
+ set(rdep_tests RUNTIME_DEPENDENCIES RUNTIME_DEPENDENCY_SET)
+endif()
+foreach(name IMPORTED_RUNTIME_ARTIFACTS ${rdep_tests})
+ add_custom_command(
+ OUTPUT ${ExportImport_BINARY_DIR}/ImportInstall-${name}
+ COMMAND ${CMAKE_COMMAND} -E rm -rf ${ExportImport_BINARY_DIR}/Import/install-${name}/install
+ COMMAND ${CMAKE_COMMAND}
+ --install ${ExportImport_BINARY_DIR}/Import/install-${name}
+ --prefix ${ExportImport_BINARY_DIR}/Import/install-${name}/install
+ ${NESTED_CONFIG_INSTALL_TYPE}
+ )
+ list(APPEND install_deps ${ExportImport_BINARY_DIR}/ImportInstall-${name})
+ set_property(
+ SOURCE ${ExportImport_BINARY_DIR}/ImportInstall-${name}
+ PROPERTY SYMBOLIC 1
+ )
+endforeach()
+add_custom_target(ImportInstallTarget ALL DEPENDS ${install_deps})
add_dependencies(ImportInstallTarget ImportTarget)
-set_property(
- SOURCE ${ExportImport_BINARY_DIR}/ImportInstall
- PROPERTY SYMBOLIC 1
- )
add_executable(ExportImport main.c)
add_dependencies(ExportImport ImportTarget)
diff --git a/Tests/ExportImport/Export/CMakeLists.txt b/Tests/ExportImport/Export/CMakeLists.txt
index fa0016b..a2968d4 100644
--- a/Tests/ExportImport/Export/CMakeLists.txt
+++ b/Tests/ExportImport/Export/CMakeLists.txt
@@ -690,3 +690,5 @@ if(NOT XCODE)
install(TARGETS testLibFromGeneratedSource EXPORT testLibFromGeneratedSource_Export)
install(EXPORT testLibFromGeneratedSource_Export DESTINATION lib)
endif()
+
+add_subdirectory(install-RUNTIME_DEPENDENCY_SET)
diff --git a/Tests/ExportImport/Export/install-RUNTIME_DEPENDENCY_SET/CMakeLists.txt b/Tests/ExportImport/Export/install-RUNTIME_DEPENDENCY_SET/CMakeLists.txt
new file mode 100644
index 0000000..f50cc1d
--- /dev/null
+++ b/Tests/ExportImport/Export/install-RUNTIME_DEPENDENCY_SET/CMakeLists.txt
@@ -0,0 +1,42 @@
+cmake_minimum_required(VERSION 3.20)
+
+set(CMAKE_SKIP_RPATH OFF)
+
+foreach(i 1 2 3 4 5 6 7 8 9 10 11 12)
+ file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/dep${i}.c"
+"#ifdef _WIN32
+__declspec(dllexport)
+#endif
+ void dep${i}(void)
+{
+}
+")
+ add_library(dep${i} SHARED "${CMAKE_CURRENT_BINARY_DIR}/dep${i}.c")
+endforeach()
+
+set_target_properties(dep9 PROPERTIES
+ FRAMEWORK TRUE
+ )
+set_target_properties(dep2 PROPERTIES
+ VERSION 1.2.3
+ SOVERSION 1
+ )
+
+add_library(deplib SHARED deplib.c)
+target_link_libraries(deplib PRIVATE dep1)
+if(CMAKE_SYSTEM_NAME STREQUAL "Darwin")
+ set_target_properties(deplib PROPERTIES
+ INSTALL_RPATH "@loader_path/"
+ )
+endif()
+
+install(TARGETS dep1 dep2 dep3 dep4 dep5 dep6 dep7 dep8 dep9 dep10 dep11 dep12 deplib EXPORT install-RUNTIME_DEPENDENCY_SET
+ RUNTIME DESTINATION install-RUNTIME_DEPENDENCY_SET/bin
+ LIBRARY DESTINATION install-RUNTIME_DEPENDENCY_SET/lib
+ ARCHIVE DESTINATION install-RUNTIME_DEPENDENCY_SET/lib
+ FRAMEWORK DESTINATION install-RUNTIME_DEPENDENCY_SET/frameworks
+ )
+install(EXPORT install-RUNTIME_DEPENDENCY_SET
+ FILE targets.cmake
+ DESTINATION install-RUNTIME_DEPENDENCY_SET
+ )
diff --git a/Tests/ExportImport/Export/install-RUNTIME_DEPENDENCY_SET/deplib.c b/Tests/ExportImport/Export/install-RUNTIME_DEPENDENCY_SET/deplib.c
new file mode 100644
index 0000000..e5da196
--- /dev/null
+++ b/Tests/ExportImport/Export/install-RUNTIME_DEPENDENCY_SET/deplib.c
@@ -0,0 +1,12 @@
+#ifdef _WIN32
+__declspec(dllimport)
+#endif
+ extern void dep1(void);
+
+#ifdef _WIN32
+__declspec(dllexport)
+#endif
+ void deplib(void)
+{
+ dep1();
+}
diff --git a/Tests/ExportImport/Import/CMakeLists.txt b/Tests/ExportImport/Import/CMakeLists.txt
index e64c6b4..0063130 100644
--- a/Tests/ExportImport/Import/CMakeLists.txt
+++ b/Tests/ExportImport/Import/CMakeLists.txt
@@ -29,3 +29,9 @@ add_subdirectory(version_range)
# Test install(IMPORTED_RUNTIME_ARTIFACTS)
add_subdirectory(install-IMPORTED_RUNTIME_ARTIFACTS)
+
+# Test install(RUNTIME_DEPENDENCIES) and install(RUNTIME_DEPENDENCY_SET)
+if(CMAKE_SYSTEM_NAME MATCHES "^(Linux|Windows|Darwin)$")
+ add_subdirectory(install-RUNTIME_DEPENDENCIES)
+ add_subdirectory(install-RUNTIME_DEPENDENCY_SET)
+endif()
diff --git a/Tests/ExportImport/Import/check_installed.cmake b/Tests/ExportImport/Import/check_installed.cmake
new file mode 100644
index 0000000..6e51f92
--- /dev/null
+++ b/Tests/ExportImport/Import/check_installed.cmake
@@ -0,0 +1,20 @@
+cmake_minimum_required(VERSION 3.20)
+
+function(check_installed expect)
+ file(GLOB_RECURSE actual
+ LIST_DIRECTORIES TRUE
+ RELATIVE ${CMAKE_INSTALL_PREFIX}
+ ${CMAKE_INSTALL_PREFIX}/*
+ )
+ if(actual)
+ list(SORT actual)
+ endif()
+ if(NOT "${actual}" MATCHES "${expect}")
+ message(FATAL_ERROR "Installed files:
+ ${actual}
+do not match what we expected:
+ ${expect}
+in directory:
+ ${CMAKE_INSTALL_PREFIX}")
+ endif()
+endfunction()
diff --git a/Tests/ExportImport/Import/install-IMPORTED_RUNTIME_ARTIFACTS/check_installed.cmake b/Tests/ExportImport/Import/install-IMPORTED_RUNTIME_ARTIFACTS/check_installed.cmake
index 29b298f..054ce9c 100644
--- a/Tests/ExportImport/Import/install-IMPORTED_RUNTIME_ARTIFACTS/check_installed.cmake
+++ b/Tests/ExportImport/Import/install-IMPORTED_RUNTIME_ARTIFACTS/check_installed.cmake
@@ -1,23 +1,4 @@
-cmake_minimum_required(VERSION 3.20)
-
-function(check_installed expect)
- file(GLOB_RECURSE actual
- LIST_DIRECTORIES TRUE
- RELATIVE ${CMAKE_INSTALL_PREFIX}
- ${CMAKE_INSTALL_PREFIX}/*
- )
- if(actual)
- list(SORT actual)
- endif()
- if(NOT "${actual}" MATCHES "${expect}")
- message(FATAL_ERROR "Installed files:
- ${actual}
-do not match what we expected:
- ${expect}
-in directory:
- ${CMAKE_INSTALL_PREFIX}")
- endif()
-endfunction()
+include("${CMAKE_CURRENT_LIST_DIR}/../check_installed.cmake")
if(CMAKE_HOST_SYSTEM_NAME STREQUAL "Linux")
set(_dirs [[aaa;aaa/executables;aaa/executables/testExe1-4;aaa/executables/testExe3;aaa/libraries;aaa/libraries/libtestExe2lib\.so;aaa/libraries/libtestLib3lib(-d|-r)?\.so\.1\.2;aaa/libraries/libtestLib3lib(-d|-r)?\.so\.3;aaa/libraries/libtestLib4\.so;aaa/libraries/libtestMod1\.so;aaa/libraries/libtestMod2\.so]])
diff --git a/Tests/ExportImport/Import/install-RUNTIME_DEPENDENCIES/CMakeLists.txt b/Tests/ExportImport/Import/install-RUNTIME_DEPENDENCIES/CMakeLists.txt
new file mode 100644
index 0000000..d1c4ff2
--- /dev/null
+++ b/Tests/ExportImport/Import/install-RUNTIME_DEPENDENCIES/CMakeLists.txt
@@ -0,0 +1,74 @@
+set(CMAKE_SKIP_RPATH OFF)
+
+# Import targets from the install tree.
+include(${Import_BINARY_DIR}/../Root/install-RUNTIME_DEPENDENCY_SET/targets.cmake)
+
+add_executable(exe1 main.c)
+add_executable(exe2 main.c)
+
+if(NOT CMAKE_SYSTEM_NAME STREQUAL "Darwin")
+ set_target_properties(exe1 exe2 PROPERTIES
+ # Multiple MACOSX_BUNDLE executables are allowed on non-macOS platforms.
+ MACOSX_BUNDLE TRUE
+ )
+endif()
+
+add_library(sublib1 SHARED sublib1.c)
+target_link_libraries(sublib1 PRIVATE dep6)
+
+add_library(sublib2 SHARED sublib2.c)
+target_link_libraries(sublib2 PRIVATE dep7)
+
+foreach(i exe1 exe2)
+ target_link_libraries(${i} PRIVATE
+ dep1
+ dep2
+ dep3
+ dep4
+ dep5
+ dep10
+ dep11
+ dep12
+ sublib1
+ sublib2
+ )
+endforeach()
+
+add_library(lib SHARED lib.c)
+target_link_libraries(lib PRIVATE dep8)
+
+add_library(mod MODULE mod.c)
+target_link_libraries(mod PRIVATE dep9)
+if(NOT CMAKE_SYSTEM_NAME STREQUAL "Darwin")
+ set_target_properties(mod PROPERTIES
+ SKIP_BUILD_RPATH TRUE
+ )
+endif()
+
+set(_framework_args)
+if(CMAKE_SYSTEM_NAME STREQUAL "Darwin")
+ set(_framework_args FRAMEWORK DESTINATION subdir/frameworks)
+endif()
+install(TARGETS exe1 exe2 lib mod sublib1
+ RUNTIME_DEPENDENCIES
+ PRE_INCLUDE_REGEXES "$<1:dep([2-9]|1[012])>"
+ PRE_EXCLUDE_REGEXES "$<1:.*>"
+ POST_INCLUDE_REGEXES "$<1:(bin|lib)/(lib)?dep3>"
+ POST_EXCLUDE_REGEXES "$<1:(bin|lib)/(lib)?dep[34]>"
+ POST_INCLUDE_FILES "$<TARGET_FILE:dep10>" "$<TARGET_FILE:dep11>"
+ POST_EXCLUDE_FILES "$<TARGET_FILE:dep11>" "$<TARGET_FILE:dep12>"
+ DIRECTORIES "$<TARGET_FILE_DIR:dep9>"
+ RUNTIME DESTINATION "$<1:subdir/bin>"
+ LIBRARY DESTINATION "$<1:subdir/lib>"
+ ${_framework_args}
+ )
+
+install(TARGETS lib
+ RUNTIME_DEPENDENCIES
+ PRE_INCLUDE_REGEXES dep8
+ PRE_EXCLUDE_REGEXES ".*"
+ DIRECTORIES "$<TARGET_FILE_DIR:dep8>"
+ ${_framework_args}
+ )
+
+install(SCRIPT "${CMAKE_CURRENT_SOURCE_DIR}/check_installed.cmake")
diff --git a/Tests/ExportImport/Import/install-RUNTIME_DEPENDENCIES/check_installed.cmake b/Tests/ExportImport/Import/install-RUNTIME_DEPENDENCIES/check_installed.cmake
new file mode 100644
index 0000000..6a34697
--- /dev/null
+++ b/Tests/ExportImport/Import/install-RUNTIME_DEPENDENCIES/check_installed.cmake
@@ -0,0 +1,11 @@
+include("${CMAKE_CURRENT_LIST_DIR}/../check_installed.cmake")
+
+if(CMAKE_HOST_SYSTEM_NAME STREQUAL "Linux")
+ check_installed([[^lib;lib/libdep8\.so;lib/liblib\.so;subdir;subdir/bin;subdir/bin/exe1;subdir/bin/exe2;subdir/lib;subdir/lib/libdep10\.so;subdir/lib/libdep11\.so;subdir/lib/libdep2\.so\.1;subdir/lib/libdep2\.so\.1\.2\.3;subdir/lib/libdep3\.so;subdir/lib/libdep5\.so;subdir/lib/libdep6\.so;subdir/lib/libdep8\.so;subdir/lib/libdep9\.so;subdir/lib/liblib\.so;subdir/lib/libmod\.so;subdir/lib/libsublib1\.so$]])
+elseif(CMAKE_HOST_SYSTEM_NAME STREQUAL "Windows")
+ set(_msvc_check [[bin;bin/dep8\.dll;bin/lib\.dll;lib;lib/lib\.lib;subdir;subdir/bin;subdir/bin/dep10\.dll;subdir/bin/dep11\.dll;subdir/bin/dep2\.dll;subdir/bin/dep3\.dll;subdir/bin/dep5\.dll;subdir/bin/dep6\.dll;subdir/bin/dep8\.dll;subdir/bin/dep9\.dll;subdir/bin/exe1\.exe;subdir/bin/exe2\.exe;subdir/bin/lib\.dll;subdir/bin/sublib1\.dll;subdir/lib;subdir/lib/mod\.dll]])
+ set(_mingw_check [[bin;bin/libdep8\.dll;bin/liblib\.dll;lib;lib/liblib\.dll\.a;lib/liblib\.lib;subdir;subdir/bin;subdir/bin/exe1\.exe;subdir/bin/exe2\.exe;subdir/bin/libdep10\.dll;subdir/bin/libdep11\.dll;subdir/bin/libdep2\.dll;subdir/bin/libdep3\.dll;subdir/bin/libdep5\.dll;subdir/bin/libdep6\.dll;subdir/bin/libdep8\.dll;subdir/bin/libdep9\.dll;subdir/bin/liblib\.dll;subdir/bin/libsublib1\.dll;subdir/lib;subdir/lib/libmod\.dll]])
+ check_installed("^(${_msvc_check}|${_mingw_check})$")
+elseif(CMAKE_HOST_SYSTEM_NAME STREQUAL "Darwin")
+ check_installed([[^lib;lib/libdep8\.dylib;lib/liblib\.dylib;subdir;subdir/bin;subdir/bin/exe1;subdir/bin/exe2;subdir/frameworks;subdir/frameworks/dep9\.framework;subdir/frameworks/dep9\.framework/Resources;subdir/frameworks/dep9\.framework/Versions;subdir/frameworks/dep9\.framework/Versions/A;subdir/frameworks/dep9\.framework/Versions/A/Resources;subdir/frameworks/dep9\.framework/Versions/A/Resources/Info\.plist(;subdir/frameworks/dep9.framework/Versions/A/_CodeSignature;subdir/frameworks/dep9.framework/Versions/A/_CodeSignature/CodeResources)?;subdir/frameworks/dep9\.framework/Versions/A/dep9;subdir/frameworks/dep9\.framework/Versions/Current;subdir/frameworks/dep9\.framework/dep9;subdir/lib;subdir/lib/libdep10\.dylib;subdir/lib/libdep11\.dylib;subdir/lib/libdep2\.1\.2\.3\.dylib;subdir/lib/libdep2\.1\.dylib;subdir/lib/libdep3\.dylib;subdir/lib/libdep5\.dylib;subdir/lib/libdep6\.dylib;subdir/lib/libdep8\.dylib;subdir/lib/liblib\.dylib;subdir/lib/libmod\.so;subdir/lib/libsublib1\.dylib$]])
+endif()
diff --git a/Tests/ExportImport/Import/install-RUNTIME_DEPENDENCIES/lib.c b/Tests/ExportImport/Import/install-RUNTIME_DEPENDENCIES/lib.c
new file mode 100644
index 0000000..9a64887
--- /dev/null
+++ b/Tests/ExportImport/Import/install-RUNTIME_DEPENDENCIES/lib.c
@@ -0,0 +1,12 @@
+#ifdef _WIN32
+__declspec(dllimport)
+#endif
+ extern void dep8(void);
+
+#ifdef _WIN32
+__declspec(dllexport)
+#endif
+ void lib(void)
+{
+ dep8();
+}
diff --git a/Tests/ExportImport/Import/install-RUNTIME_DEPENDENCIES/main.c b/Tests/ExportImport/Import/install-RUNTIME_DEPENDENCIES/main.c
new file mode 100644
index 0000000..94a7862
--- /dev/null
+++ b/Tests/ExportImport/Import/install-RUNTIME_DEPENDENCIES/main.c
@@ -0,0 +1,31 @@
+#ifdef _WIN32
+# define DLLIMPORT __declspec(dllimport)
+#else
+# define DLLIMPORT
+#endif
+
+DLLIMPORT extern void dep1(void);
+DLLIMPORT extern void dep2(void);
+DLLIMPORT extern void dep3(void);
+DLLIMPORT extern void dep4(void);
+DLLIMPORT extern void dep5(void);
+DLLIMPORT extern void dep10(void);
+DLLIMPORT extern void dep11(void);
+DLLIMPORT extern void dep12(void);
+DLLIMPORT extern void sublib1(void);
+DLLIMPORT extern void sublib2(void);
+
+int main(void)
+{
+ dep1();
+ dep2();
+ dep3();
+ dep4();
+ dep5();
+ dep10();
+ dep11();
+ dep12();
+ sublib1();
+ sublib2();
+ return 0;
+}
diff --git a/Tests/ExportImport/Import/install-RUNTIME_DEPENDENCIES/mod.c b/Tests/ExportImport/Import/install-RUNTIME_DEPENDENCIES/mod.c
new file mode 100644
index 0000000..d001299
--- /dev/null
+++ b/Tests/ExportImport/Import/install-RUNTIME_DEPENDENCIES/mod.c
@@ -0,0 +1,12 @@
+#ifdef _WIN32
+__declspec(dllimport)
+#endif
+ extern void dep9(void);
+
+#ifdef _WIN32
+__declspec(dllexport)
+#endif
+ void mod(void)
+{
+ dep9();
+}
diff --git a/Tests/ExportImport/Import/install-RUNTIME_DEPENDENCIES/sublib1.c b/Tests/ExportImport/Import/install-RUNTIME_DEPENDENCIES/sublib1.c
new file mode 100644
index 0000000..f17b902
--- /dev/null
+++ b/Tests/ExportImport/Import/install-RUNTIME_DEPENDENCIES/sublib1.c
@@ -0,0 +1,12 @@
+#ifdef _WIN32
+__declspec(dllimport)
+#endif
+ extern void dep6(void);
+
+#ifdef _WIN32
+__declspec(dllexport)
+#endif
+ void sublib1(void)
+{
+ dep6();
+}
diff --git a/Tests/ExportImport/Import/install-RUNTIME_DEPENDENCIES/sublib2.c b/Tests/ExportImport/Import/install-RUNTIME_DEPENDENCIES/sublib2.c
new file mode 100644
index 0000000..61b5c83
--- /dev/null
+++ b/Tests/ExportImport/Import/install-RUNTIME_DEPENDENCIES/sublib2.c
@@ -0,0 +1,12 @@
+#ifdef _WIN32
+__declspec(dllimport)
+#endif
+ extern void dep7(void);
+
+#ifdef _WIN32
+__declspec(dllexport)
+#endif
+ void sublib2(void)
+{
+ dep7();
+}
diff --git a/Tests/ExportImport/Import/install-RUNTIME_DEPENDENCY_SET/CMakeLists.txt b/Tests/ExportImport/Import/install-RUNTIME_DEPENDENCY_SET/CMakeLists.txt
new file mode 100644
index 0000000..5164506
--- /dev/null
+++ b/Tests/ExportImport/Import/install-RUNTIME_DEPENDENCY_SET/CMakeLists.txt
@@ -0,0 +1,33 @@
+set(CMAKE_SKIP_RPATH OFF)
+
+# Import targets from the install tree.
+include(${Import_BINARY_DIR}/../Root/install-RUNTIME_DEPENDENCY_SET/targets.cmake)
+
+add_executable(exe main.c)
+target_link_libraries(exe PRIVATE dep3 dep4)
+
+install(TARGETS exe RUNTIME_DEPENDENCY_SET myset)
+install(IMPORTED_RUNTIME_ARTIFACTS deplib RUNTIME_DEPENDENCY_SET myset)
+
+install(RUNTIME_DEPENDENCY_SET myset
+ PRE_INCLUDE_REGEXES "dep[134]"
+ PRE_EXCLUDE_REGEXES ".*"
+ POST_INCLUDE_REGEXES "dep[13]"
+ POST_EXCLUDE_REGEXES "dep[34]"
+ DIRECTORIES "$<TARGET_FILE_DIR:dep1>"
+ )
+install(RUNTIME_DEPENDENCY_SET myset
+ PRE_INCLUDE_REGEXES "dep[134]"
+ PRE_EXCLUDE_REGEXES ".*"
+ DIRECTORIES "$<TARGET_FILE_DIR:dep1>"
+ RUNTIME DESTINATION yyy/bin
+ LIBRARY DESTINATION yyy/lib
+ )
+install(RUNTIME_DEPENDENCY_SET myset
+ PRE_INCLUDE_REGEXES "dep[134]"
+ PRE_EXCLUDE_REGEXES ".*"
+ DIRECTORIES "$<TARGET_FILE_DIR:dep1>"
+ DESTINATION zzz
+ )
+
+install(SCRIPT "${CMAKE_CURRENT_SOURCE_DIR}/check_installed.cmake")
diff --git a/Tests/ExportImport/Import/install-RUNTIME_DEPENDENCY_SET/check_installed.cmake b/Tests/ExportImport/Import/install-RUNTIME_DEPENDENCY_SET/check_installed.cmake
new file mode 100644
index 0000000..052cced
--- /dev/null
+++ b/Tests/ExportImport/Import/install-RUNTIME_DEPENDENCY_SET/check_installed.cmake
@@ -0,0 +1,11 @@
+include("${CMAKE_CURRENT_LIST_DIR}/../check_installed.cmake")
+
+if(CMAKE_HOST_SYSTEM_NAME STREQUAL "Linux")
+ check_installed([[^bin;bin/exe;lib;lib/libdep1\.so;lib/libdep3\.so;lib/libdeplib\.so;yyy;yyy/lib;yyy/lib/libdep1\.so;yyy/lib/libdep3\.so;yyy/lib/libdep4\.so;zzz;zzz/libdep1\.so;zzz/libdep3\.so;zzz/libdep4\.so$]])
+elseif(CMAKE_HOST_SYSTEM_NAME STREQUAL "Windows")
+ set(_msvc_check [[bin;bin/dep1\.dll;bin/dep3\.dll;bin/deplib\.dll;bin/exe\.exe;yyy;yyy/bin;yyy/bin/dep1\.dll;yyy/bin/dep3\.dll;yyy/bin/dep4\.dll;zzz;zzz/dep1\.dll;zzz/dep3\.dll;zzz/dep4\.dll]])
+ set(_mingw_check [[bin;bin/exe\.exe;bin/libdep1\.dll;bin/libdep3\.dll;bin/libdeplib\.dll;yyy;yyy/bin;yyy/bin/libdep1\.dll;yyy/bin/libdep3\.dll;yyy/bin/libdep4\.dll;zzz;zzz/libdep1\.dll;zzz/libdep3\.dll;zzz/libdep4\.dll]])
+ check_installed("^(${_msvc_check}|${_mingw_check})$")
+elseif(CMAKE_HOST_SYSTEM_NAME STREQUAL "Darwin")
+ check_installed([[^bin;bin/exe;lib;lib/libdep1\.dylib;lib/libdep3\.dylib;lib/libdeplib\.dylib;yyy;yyy/lib;yyy/lib/libdep1\.dylib;yyy/lib/libdep3\.dylib;yyy/lib/libdep4\.dylib;zzz;zzz/libdep1\.dylib;zzz/libdep3\.dylib;zzz/libdep4\.dylib$]])
+endif()
diff --git a/Tests/ExportImport/Import/install-RUNTIME_DEPENDENCY_SET/main.c b/Tests/ExportImport/Import/install-RUNTIME_DEPENDENCY_SET/main.c
new file mode 100644
index 0000000..b359498
--- /dev/null
+++ b/Tests/ExportImport/Import/install-RUNTIME_DEPENDENCY_SET/main.c
@@ -0,0 +1,15 @@
+#ifdef _WIN32
+__declspec(dllimport)
+#endif
+ extern void dep3(void);
+#ifdef _WIN32
+__declspec(dllimport)
+#endif
+ extern void dep4(void);
+
+int main(void)
+{
+ dep3();
+ dep4();
+ return 0;
+}
diff --git a/Tests/RunCMake/FileAPI/codemodel-v2-check.py b/Tests/RunCMake/FileAPI/codemodel-v2-check.py
index 9911ad5..6cf57a3 100644
--- a/Tests/RunCMake/FileAPI/codemodel-v2-check.py
+++ b/Tests/RunCMake/FileAPI/codemodel-v2-check.py
@@ -180,6 +180,14 @@ def check_directory(c):
expected_keys.append("scriptFile")
assert is_string(a["scriptFile"], e["scriptFile"])
+ if e.get("runtimeDependencySetName", None) is not None:
+ expected_keys.append("runtimeDependencySetName")
+ assert is_string(a["runtimeDependencySetName"], e["runtimeDependencySetName"])
+
+ if e.get("runtimeDependencySetType", None) is not None:
+ expected_keys.append("runtimeDependencySetType")
+ assert is_string(a["runtimeDependencySetType"], e["runtimeDependencySetType"])
+
if e["backtrace"] is not None:
expected_keys.append("backtrace")
check_backtrace(d, a["backtrace"], e["backtrace"])
@@ -650,6 +658,14 @@ def gen_check_directories(c, g):
if "pathsNamelink" in i:
i["paths"] = i["pathsNamelink"]
+ if sys.platform not in ("win32", "darwin") and "linux" not in sys.platform:
+ for e in expected:
+ e["installers"] = list(filter(lambda i: i["type"] != "runtimeDependencySet", e["installers"]))
+
+ if sys.platform != "darwin":
+ for e in expected:
+ e["installers"] = list(filter(lambda i: i.get("runtimeDependencySetType", None) != "framework", e["installers"]))
+
return expected
def check_directories(c, g):
diff --git a/Tests/RunCMake/FileAPI/codemodel-v2-data/directories/cxx.json b/Tests/RunCMake/FileAPI/codemodel-v2-data/directories/cxx.json
index 7168306..8052c1a 100644
--- a/Tests/RunCMake/FileAPI/codemodel-v2-data/directories/cxx.json
+++ b/Tests/RunCMake/FileAPI/codemodel-v2-data/directories/cxx.json
@@ -17,6 +17,165 @@
],
"projectName": "Cxx",
"minimumCMakeVersion": "3.12",
- "hasInstallRule": null,
- "installers": []
+ "hasInstallRule": true,
+ "installers": [
+ {
+ "component": "Unspecified",
+ "type": "target",
+ "destination": "lib",
+ "paths": [
+ "^cxx/((Debug|Release|MinSizeRel|RelWithDebInfo)/)?cxx_exe(\\.exe)?$"
+ ],
+ "isExcludeFromAll": null,
+ "isForAllComponents": null,
+ "isOptional": null,
+ "targetId": "^cxx_exe::@a56b12a3f5c0529fb296$",
+ "targetIndex": "cxx_exe",
+ "targetIsImportLibrary": null,
+ "targetInstallNamelink": null,
+ "exportName": null,
+ "exportTargets": null,
+ "scriptFile": null,
+ "backtrace": [
+ {
+ "file": "^cxx/CMakeLists\\.txt$",
+ "line": 38,
+ "command": "install",
+ "hasParent": true
+ },
+ {
+ "file": "^cxx/CMakeLists\\.txt$",
+ "line": null,
+ "command": null,
+ "hasParent": false
+ }
+ ]
+ },
+ {
+ "component": "Unspecified",
+ "type": "runtimeDependencySet",
+ "destination": "lib",
+ "paths": null,
+ "isExcludeFromAll": null,
+ "isForAllComponents": null,
+ "isOptional": null,
+ "targetId": null,
+ "targetIndex": null,
+ "targetIsImportLibrary": null,
+ "targetInstallNamelink": null,
+ "exportName": null,
+ "exportTargets": null,
+ "scriptFile": null,
+ "runtimeDependencySetType": "library",
+ "backtrace": [
+ {
+ "file": "^cxx/CMakeLists\\.txt$",
+ "line": 38,
+ "command": "install",
+ "hasParent": true
+ },
+ {
+ "file": "^cxx/CMakeLists\\.txt$",
+ "line": null,
+ "command": null,
+ "hasParent": false
+ }
+ ]
+ },
+ {
+ "component": "Unspecified",
+ "type": "runtimeDependencySet",
+ "destination": "fw",
+ "paths": null,
+ "isExcludeFromAll": null,
+ "isForAllComponents": null,
+ "isOptional": null,
+ "targetId": null,
+ "targetIndex": null,
+ "targetIsImportLibrary": null,
+ "targetInstallNamelink": null,
+ "exportName": null,
+ "exportTargets": null,
+ "scriptFile": null,
+ "runtimeDependencySetType": "framework",
+ "backtrace": [
+ {
+ "file": "^cxx/CMakeLists\\.txt$",
+ "line": 38,
+ "command": "install",
+ "hasParent": true
+ },
+ {
+ "file": "^cxx/CMakeLists\\.txt$",
+ "line": null,
+ "command": null,
+ "hasParent": false
+ }
+ ]
+ },
+ {
+ "component": "Unspecified",
+ "type": "runtimeDependencySet",
+ "destination": "lib",
+ "paths": null,
+ "isExcludeFromAll": null,
+ "isForAllComponents": null,
+ "isOptional": null,
+ "targetId": null,
+ "targetIndex": null,
+ "targetIsImportLibrary": null,
+ "targetInstallNamelink": null,
+ "exportName": null,
+ "exportTargets": null,
+ "scriptFile": null,
+ "runtimeDependencySetType": "library",
+ "runtimeDependencySetName": "deps",
+ "backtrace": [
+ {
+ "file": "^cxx/CMakeLists\\.txt$",
+ "line": 43,
+ "command": "install",
+ "hasParent": true
+ },
+ {
+ "file": "^cxx/CMakeLists\\.txt$",
+ "line": null,
+ "command": null,
+ "hasParent": false
+ }
+ ]
+ },
+ {
+ "component": "Unspecified",
+ "type": "runtimeDependencySet",
+ "destination": "fw",
+ "paths": null,
+ "isExcludeFromAll": null,
+ "isForAllComponents": null,
+ "isOptional": null,
+ "targetId": null,
+ "targetIndex": null,
+ "targetIsImportLibrary": null,
+ "targetInstallNamelink": null,
+ "exportName": null,
+ "exportTargets": null,
+ "scriptFile": null,
+ "runtimeDependencySetType": "framework",
+ "runtimeDependencySetName": "deps",
+ "backtrace": [
+ {
+ "file": "^cxx/CMakeLists\\.txt$",
+ "line": 43,
+ "command": "install",
+ "hasParent": true
+ },
+ {
+ "file": "^cxx/CMakeLists\\.txt$",
+ "line": null,
+ "command": null,
+ "hasParent": false
+ }
+ ]
+ }
+ ]
}
diff --git a/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/cxx_exe.json b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/cxx_exe.json
index c9e652b..385fa62 100644
--- a/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/cxx_exe.json
+++ b/Tests/RunCMake/FileAPI/codemodel-v2-data/targets/cxx_exe.json
@@ -115,6 +115,23 @@
"prefix": "^(/usr/local|[A-Za-z]:.*/codemodel-v2)$",
"destinations": [
{
+ "path": "lib",
+ "backtrace": [
+ {
+ "file": "^cxx/CMakeLists\\.txt$",
+ "line": 38,
+ "command": "install",
+ "hasParent": true
+ },
+ {
+ "file": "^cxx/CMakeLists\\.txt$",
+ "line": null,
+ "command": null,
+ "hasParent": false
+ }
+ ]
+ },
+ {
"path": "bin",
"backtrace": [
{
diff --git a/Tests/RunCMake/FileAPI/cxx/CMakeLists.txt b/Tests/RunCMake/FileAPI/cxx/CMakeLists.txt
index 95c803f..3ae3b60 100644
--- a/Tests/RunCMake/FileAPI/cxx/CMakeLists.txt
+++ b/Tests/RunCMake/FileAPI/cxx/CMakeLists.txt
@@ -30,3 +30,18 @@ if(CMAKE_CXX_STANDARD_DEFAULT AND DEFINED CMAKE_CXX11_STANDARD_COMPILE_OPTION)
target_compile_features(cxx_standard_compile_feature_exe PRIVATE cxx_decltype)
file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/cxx_std_11.txt" "")
endif()
+
+set(_rdeps)
+if(CMAKE_SYSTEM_NAME MATCHES "^(Linux|Windows|Darwin)$")
+ set(_rdeps RUNTIME_DEPENDENCIES)
+endif()
+install(TARGETS cxx_exe ${_rdeps}
+ DESTINATION lib
+ FRAMEWORK DESTINATION fw
+ )
+if(_rdeps)
+ install(RUNTIME_DEPENDENCY_SET deps
+ DESTINATION lib
+ FRAMEWORK DESTINATION fw
+ )
+endif()
diff --git a/Tests/RunCMake/file-GET_RUNTIME_DEPENDENCIES/RunCMakeTest.cmake b/Tests/RunCMake/file-GET_RUNTIME_DEPENDENCIES/RunCMakeTest.cmake
index c71b9ba..07679b7 100644
--- a/Tests/RunCMake/file-GET_RUNTIME_DEPENDENCIES/RunCMakeTest.cmake
+++ b/Tests/RunCMake/file-GET_RUNTIME_DEPENDENCIES/RunCMakeTest.cmake
@@ -36,6 +36,7 @@ endfunction()
if(CMAKE_HOST_SYSTEM_NAME STREQUAL "Darwin")
if(NOT CMake_INSTALL_NAME_TOOL_BUG)
run_install_test(macos)
+ run_install_test(macos-rpath)
run_install_test(macos-unresolved)
run_install_test(macos-conflict)
run_install_test(macos-notfile)
diff --git a/Tests/RunCMake/file-GET_RUNTIME_DEPENDENCIES/macos-rpath.cmake b/Tests/RunCMake/file-GET_RUNTIME_DEPENDENCIES/macos-rpath.cmake
new file mode 100644
index 0000000..798045f
--- /dev/null
+++ b/Tests/RunCMake/file-GET_RUNTIME_DEPENDENCIES/macos-rpath.cmake
@@ -0,0 +1,35 @@
+enable_language(C)
+
+file(WRITE "${CMAKE_BINARY_DIR}/toplib.c" "extern void sublib1(void);\nextern void sublib2(void);\nvoid toplib(void)\n{\n sublib1();\n sublib2();\n}\n")
+add_library(toplib SHARED "${CMAKE_BINARY_DIR}/toplib.c")
+file(WRITE "${CMAKE_BINARY_DIR}/sublib1.c" "extern void sublib2(void);\nvoid sublib1(void)\n{\n sublib2();\n}\n")
+add_library(sublib1 SHARED "${CMAKE_BINARY_DIR}/sublib1.c")
+file(WRITE "${CMAKE_BINARY_DIR}/sublib2.c" "void sublib2(void)\n{\n}\n")
+add_library(sublib2 SHARED "${CMAKE_BINARY_DIR}/sublib2.c")
+target_link_libraries(toplib PRIVATE sublib1 sublib2)
+target_link_libraries(sublib1 PRIVATE sublib2)
+set_property(TARGET toplib PROPERTY INSTALL_RPATH "@loader_path/d1;@loader_path/d2")
+set_property(TARGET sublib1 PROPERTY INSTALL_RPATH "@loader_path/;@loader_path/../d2")
+install(TARGETS toplib DESTINATION lib)
+install(TARGETS sublib1 DESTINATION lib/d1)
+install(TARGETS sublib2 DESTINATION lib/d2)
+
+install(CODE [[
+ file(GET_RUNTIME_DEPENDENCIES
+ LIBRARIES
+ "${CMAKE_INSTALL_PREFIX}/lib/$<TARGET_FILE_NAME:toplib>"
+ RPATH_PREFIX _rpaths
+ )
+
+ set(_expected_rpath "(^|;)@loader_path/;@loader_path/\\.\\./d2$")
+ set(_actual_rpath "${_rpaths_${CMAKE_INSTALL_PREFIX}/lib/d1/$<TARGET_FILE_NAME:sublib1>}")
+ if(NOT _actual_rpath MATCHES "${_expected_rpath}")
+ message(FATAL_ERROR "Expected rpath:\n ${_expected_rpath}\nActual rpath:\n ${_actual_rpath}")
+ endif()
+
+ # Since RPATH_PREFIX is an undocumented option for install(), we don't really need the rpath
+ # for the top files anyway.
+ if(DEFINED "_rpaths_${CMAKE_INSTALL_PREFIX}/lib/$<TARGET_FILE_NAME:toplib>")
+ message(FATAL_ERROR "rpath for top library should not be defined")
+ endif()
+ ]])
diff --git a/Tests/RunCMake/file-RPATH/Common.cmake b/Tests/RunCMake/file-RPATH/Common.cmake
index cc1efb5..7034aad 100644
--- a/Tests/RunCMake/file-RPATH/Common.cmake
+++ b/Tests/RunCMake/file-RPATH/Common.cmake
@@ -62,3 +62,40 @@ foreach(f ${files})
message(FATAL_ERROR "RPATH_CHECK did not remove ${f}")
endif()
endforeach()
+
+# TODO Implement RPATH_SET in XCOFF.
+if(format STREQUAL "ELF")
+ foreach(f ${names})
+ file(COPY ${in}/${f} DESTINATION ${out} NO_SOURCE_PERMISSIONS)
+ endforeach()
+
+ foreach(f ${files})
+ # Set the RPATH.
+ file(RPATH_SET FILE "${f}"
+ NEW_RPATH "/new/rpath")
+ set(rpath)
+ file(STRINGS "${f}" rpath REGEX "/new/rpath" LIMIT_COUNT 1)
+ if(NOT rpath)
+ message(FATAL_ERROR "RPATH not set in ${f}")
+ endif()
+ file(STRINGS "${f}" rpath REGEX "/rpath/sample" LIMIT_COUNT 1)
+ if(rpath)
+ message(FATAL_EROR "RPATH not removed in ${f}")
+ endif()
+
+ # Remove the RPATH.
+ file(RPATH_SET FILE "${f}"
+ NEW_RPATH "")
+ set(rpath)
+ file(STRINGS "${f}" rpath REGEX "/new/rpath" LIMIT_COUNT 1)
+ if(rpath)
+ message(FATAL_ERROR "RPATH not removed from ${f}")
+ endif()
+
+ # Check again...this should remove the file.
+ file(RPATH_CHECK FILE "${f}" RPATH "/new/rpath")
+ if(EXISTS "${f}")
+ message(FATAL_ERROR "RPATH_CHECK did not remove ${f}")
+ endif()
+ endforeach()
+endif()
diff --git a/Tests/RunCMake/install/IMPORTED_RUNTIME_ARTIFACTS-RUNTIME_DEPENDENCY_SET-unsupported-result.txt b/Tests/RunCMake/install/IMPORTED_RUNTIME_ARTIFACTS-RUNTIME_DEPENDENCY_SET-unsupported-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/install/IMPORTED_RUNTIME_ARTIFACTS-RUNTIME_DEPENDENCY_SET-unsupported-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/install/IMPORTED_RUNTIME_ARTIFACTS-RUNTIME_DEPENDENCY_SET-unsupported-stderr.txt b/Tests/RunCMake/install/IMPORTED_RUNTIME_ARTIFACTS-RUNTIME_DEPENDENCY_SET-unsupported-stderr.txt
new file mode 100644
index 0000000..7ae6606
--- /dev/null
+++ b/Tests/RunCMake/install/IMPORTED_RUNTIME_ARTIFACTS-RUNTIME_DEPENDENCY_SET-unsupported-stderr.txt
@@ -0,0 +1,6 @@
+^CMake Error at IMPORTED_RUNTIME_ARTIFACTS-RUNTIME_DEPENDENCY_SET-unsupported\.cmake:[0-9]+ \(install\):
+ install IMPORTED_RUNTIME_ARTIFACTS 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/IMPORTED_RUNTIME_ARTIFACTS-RUNTIME_DEPENDENCY_SET-unsupported.cmake b/Tests/RunCMake/install/IMPORTED_RUNTIME_ARTIFACTS-RUNTIME_DEPENDENCY_SET-unsupported.cmake
new file mode 100644
index 0000000..04f1995
--- /dev/null
+++ b/Tests/RunCMake/install/IMPORTED_RUNTIME_ARTIFACTS-RUNTIME_DEPENDENCY_SET-unsupported.cmake
@@ -0,0 +1,2 @@
+add_executable(exe IMPORTED)
+install(IMPORTED_RUNTIME_ARTIFACTS exe RUNTIME_DEPENDENCY_SET deps)
diff --git a/Tests/RunCMake/install/RUNTIME_DEPENDENCY_SET-unsupported-result.txt b/Tests/RunCMake/install/RUNTIME_DEPENDENCY_SET-unsupported-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/install/RUNTIME_DEPENDENCY_SET-unsupported-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/install/RUNTIME_DEPENDENCY_SET-unsupported-stderr.txt b/Tests/RunCMake/install/RUNTIME_DEPENDENCY_SET-unsupported-stderr.txt
new file mode 100644
index 0000000..cab309b
--- /dev/null
+++ b/Tests/RunCMake/install/RUNTIME_DEPENDENCY_SET-unsupported-stderr.txt
@@ -0,0 +1,5 @@
+^CMake Error at RUNTIME_DEPENDENCY_SET-unsupported\.cmake:[0-9]+ \(install\):
+ install 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/RUNTIME_DEPENDENCY_SET-unsupported.cmake b/Tests/RunCMake/install/RUNTIME_DEPENDENCY_SET-unsupported.cmake
new file mode 100644
index 0000000..60772a0
--- /dev/null
+++ b/Tests/RunCMake/install/RUNTIME_DEPENDENCY_SET-unsupported.cmake
@@ -0,0 +1 @@
+install(RUNTIME_DEPENDENCY_SET deps)
diff --git a/Tests/RunCMake/install/RunCMakeTest.cmake b/Tests/RunCMake/install/RunCMakeTest.cmake
index 94887a0..f79a3ea 100644
--- a/Tests/RunCMake/install/RunCMakeTest.cmake
+++ b/Tests/RunCMake/install/RunCMakeTest.cmake
@@ -44,7 +44,7 @@ function(check_installed expect)
do not match what we expected:
${expect}
in directory:
- ${CMAKE_INSTALL_PREFIX}" PARENT_SCOPE)
+ ${CMAKE_INSTALL_PREFIX}\n" PARENT_SCOPE)
endif()
endfunction()
@@ -174,6 +174,26 @@ run_install_test(FILES-PERMISSIONS)
run_install_test(TARGETS-RPATH)
run_install_test(InstallRequiredSystemLibraries)
+if(CMAKE_SYSTEM_NAME STREQUAL "Darwin")
+ run_cmake(TARGETS-RUNTIME_DEPENDENCIES-macos-two-bundle)
+ run_cmake(TARGETS-RUNTIME_DEPENDENCIES-macos-no-framework)
+endif()
+
+if(CMAKE_SYSTEM_NAME MATCHES "^(Linux|Darwin|Windows)$")
+ run_install_test(TARGETS-RUNTIME_DEPENDENCIES-nodep)
+ run_install_test(TARGETS-RUNTIME_DEPENDENCIES-empty)
+ 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)
+ run_cmake(RuntimeDependencies-COMPONENTS)
+else()
+ run_cmake(TARGETS-RUNTIME_DEPENDENCIES-unsupported)
+ run_cmake(TARGETS-RUNTIME_DEPENDENCY_SET-unsupported)
+ run_cmake(IMPORTED_RUNTIME_ARTIFACTS-RUNTIME_DEPENDENCY_SET-unsupported)
+ run_cmake(RUNTIME_DEPENDENCY_SET-unsupported)
+endif()
+
set(run_install_test_components 1)
run_install_test(FILES-EXCLUDE_FROM_ALL)
run_install_test(TARGETS-EXCLUDE_FROM_ALL)
diff --git a/Tests/RunCMake/install/RuntimeDependencies-COMPONENTS.cmake b/Tests/RunCMake/install/RuntimeDependencies-COMPONENTS.cmake
new file mode 100644
index 0000000..4727de3
--- /dev/null
+++ b/Tests/RunCMake/install/RuntimeDependencies-COMPONENTS.cmake
@@ -0,0 +1,39 @@
+enable_language(C)
+
+function(check_components value)
+ get_cmake_property(comp COMPONENTS)
+ if(NOT comp STREQUAL value)
+ message(FATAL_ERROR "Expected value of COMPONENTS:\n ${value}\nActual value of COMPONENTS:\n ${comp}")
+ endif()
+endfunction()
+
+if(CMAKE_SYSTEM_NAME STREQUAL "Windows")
+ add_library(tgt MODULE obj1.c)
+else()
+ add_executable(tgt main.c)
+endif()
+
+install(TARGETS tgt
+ RUNTIME_DEPENDENCIES
+ RUNTIME DESTINATION bin COMPONENT bin1
+ LIBRARY DESTINATION lib COMPONENT lib1
+ FRAMEWORK DESTINATION fw COMPONENT fw1
+ )
+if(CMAKE_SYSTEM_NAME STREQUAL "Darwin")
+ check_components("bin1;fw1;lib1")
+else()
+ check_components("bin1;lib1")
+endif()
+
+install(RUNTIME_DEPENDENCY_SET deps
+ RUNTIME DESTINATION bin COMPONENT bin2
+ LIBRARY DESTINATION lib COMPONENT lib2
+ FRAMEWORK DESTINATION fw COMPONENT fw2
+ )
+if(CMAKE_SYSTEM_NAME STREQUAL "Darwin")
+ check_components("bin1;fw1;fw2;lib1;lib2")
+elseif(CMAKE_SYSTEM_NAME STREQUAL "Windows")
+ check_components("bin1;bin2;lib1")
+elseif()
+ check_components("bin1;lib1;lib2")
+endif()
diff --git a/Tests/RunCMake/install/TARGETS-RUNTIME_DEPENDENCIES-cross-result.txt b/Tests/RunCMake/install/TARGETS-RUNTIME_DEPENDENCIES-cross-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/install/TARGETS-RUNTIME_DEPENDENCIES-cross-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/install/TARGETS-RUNTIME_DEPENDENCIES-cross-stderr.txt b/Tests/RunCMake/install/TARGETS-RUNTIME_DEPENDENCIES-cross-stderr.txt
new file mode 100644
index 0000000..b7bbb55
--- /dev/null
+++ b/Tests/RunCMake/install/TARGETS-RUNTIME_DEPENDENCIES-cross-stderr.txt
@@ -0,0 +1,4 @@
+^CMake Error at TARGETS-RUNTIME_DEPENDENCIES-cross\.cmake:[0-9]+ \(install\):
+ install TARGETS RUNTIME_DEPENDENCIES is not supported when cross-compiling\.
+Call Stack \(most recent call first\):
+ CMakeLists.txt:[0-9]+ \(include\)$
diff --git a/Tests/RunCMake/install/TARGETS-RUNTIME_DEPENDENCIES-cross.cmake b/Tests/RunCMake/install/TARGETS-RUNTIME_DEPENDENCIES-cross.cmake
new file mode 100644
index 0000000..36b2eb7
--- /dev/null
+++ b/Tests/RunCMake/install/TARGETS-RUNTIME_DEPENDENCIES-cross.cmake
@@ -0,0 +1,4 @@
+enable_language(C)
+
+add_executable(exe main.c)
+install(TARGETS exe RUNTIME_DEPENDENCIES)
diff --git a/Tests/RunCMake/install/TARGETS-RUNTIME_DEPENDENCIES-empty-all-check.cmake b/Tests/RunCMake/install/TARGETS-RUNTIME_DEPENDENCIES-empty-all-check.cmake
new file mode 100644
index 0000000..dafc2a4
--- /dev/null
+++ b/Tests/RunCMake/install/TARGETS-RUNTIME_DEPENDENCIES-empty-all-check.cmake
@@ -0,0 +1 @@
+check_installed([[^static;static/(liblib\.a|lib\.lib)$]])
diff --git a/Tests/RunCMake/install/TARGETS-RUNTIME_DEPENDENCIES-empty.cmake b/Tests/RunCMake/install/TARGETS-RUNTIME_DEPENDENCIES-empty.cmake
new file mode 100644
index 0000000..e46e1d9
--- /dev/null
+++ b/Tests/RunCMake/install/TARGETS-RUNTIME_DEPENDENCIES-empty.cmake
@@ -0,0 +1,9 @@
+enable_language(C)
+
+add_library(lib STATIC obj1.c)
+
+install(TARGETS lib RUNTIME_DEPENDENCIES
+ LIBRARY DESTINATION lib
+ ARCHIVE DESTINATION static
+ FRAMEWORK DESTINATION fw
+ )
diff --git a/Tests/RunCMake/install/TARGETS-RUNTIME_DEPENDENCIES-macos-no-framework-result.txt b/Tests/RunCMake/install/TARGETS-RUNTIME_DEPENDENCIES-macos-no-framework-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/install/TARGETS-RUNTIME_DEPENDENCIES-macos-no-framework-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/install/TARGETS-RUNTIME_DEPENDENCIES-macos-no-framework-stderr.txt b/Tests/RunCMake/install/TARGETS-RUNTIME_DEPENDENCIES-macos-no-framework-stderr.txt
new file mode 100644
index 0000000..6ab14f6
--- /dev/null
+++ b/Tests/RunCMake/install/TARGETS-RUNTIME_DEPENDENCIES-macos-no-framework-stderr.txt
@@ -0,0 +1,4 @@
+^CMake Error at TARGETS-RUNTIME_DEPENDENCIES-macos-no-framework\.cmake:[0-9]+ \(install\):
+ install TARGETS RUNTIME_DEPENDENCIES given no FRAMEWORK DESTINATION
+Call Stack \(most recent call first\):
+ CMakeLists\.txt:[0-9]+ \(include\)$
diff --git a/Tests/RunCMake/install/TARGETS-RUNTIME_DEPENDENCIES-macos-no-framework.cmake b/Tests/RunCMake/install/TARGETS-RUNTIME_DEPENDENCIES-macos-no-framework.cmake
new file mode 100644
index 0000000..36b2eb7
--- /dev/null
+++ b/Tests/RunCMake/install/TARGETS-RUNTIME_DEPENDENCIES-macos-no-framework.cmake
@@ -0,0 +1,4 @@
+enable_language(C)
+
+add_executable(exe main.c)
+install(TARGETS exe RUNTIME_DEPENDENCIES)
diff --git a/Tests/RunCMake/install/TARGETS-RUNTIME_DEPENDENCIES-macos-two-bundle-result.txt b/Tests/RunCMake/install/TARGETS-RUNTIME_DEPENDENCIES-macos-two-bundle-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/install/TARGETS-RUNTIME_DEPENDENCIES-macos-two-bundle-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/install/TARGETS-RUNTIME_DEPENDENCIES-macos-two-bundle-stderr.txt b/Tests/RunCMake/install/TARGETS-RUNTIME_DEPENDENCIES-macos-two-bundle-stderr.txt
new file mode 100644
index 0000000..c7b49c7
--- /dev/null
+++ b/Tests/RunCMake/install/TARGETS-RUNTIME_DEPENDENCIES-macos-two-bundle-stderr.txt
@@ -0,0 +1,4 @@
+^CMake Error at TARGETS-RUNTIME_DEPENDENCIES-macos-two-bundle\.cmake:[0-9]+ \(install\):
+ install A runtime dependency set may only have one bundle executable\.
+Call Stack \(most recent call first\):
+ CMakeLists.txt:[0-9]+ \(include\)$
diff --git a/Tests/RunCMake/install/TARGETS-RUNTIME_DEPENDENCIES-macos-two-bundle.cmake b/Tests/RunCMake/install/TARGETS-RUNTIME_DEPENDENCIES-macos-two-bundle.cmake
new file mode 100644
index 0000000..a848a24
--- /dev/null
+++ b/Tests/RunCMake/install/TARGETS-RUNTIME_DEPENDENCIES-macos-two-bundle.cmake
@@ -0,0 +1,10 @@
+enable_language(C)
+
+add_executable(exe1 MACOSX_BUNDLE main.c)
+add_executable(exe2 MACOSX_BUNDLE main.c)
+
+install(TARGETS exe1 exe2
+ RUNTIME_DEPENDENCIES
+ BUNDLE DESTINATION bundles
+ FRAMEWORK DESTINATION fw
+ )
diff --git a/Tests/RunCMake/install/TARGETS-RUNTIME_DEPENDENCIES-nodep-all-check.cmake b/Tests/RunCMake/install/TARGETS-RUNTIME_DEPENDENCIES-nodep-all-check.cmake
new file mode 100644
index 0000000..9f455b1
--- /dev/null
+++ b/Tests/RunCMake/install/TARGETS-RUNTIME_DEPENDENCIES-nodep-all-check.cmake
@@ -0,0 +1 @@
+check_installed([[^bin;bin/exe(\.exe)?$]])
diff --git a/Tests/RunCMake/install/TARGETS-RUNTIME_DEPENDENCIES-nodep.cmake b/Tests/RunCMake/install/TARGETS-RUNTIME_DEPENDENCIES-nodep.cmake
new file mode 100644
index 0000000..02466561
--- /dev/null
+++ b/Tests/RunCMake/install/TARGETS-RUNTIME_DEPENDENCIES-nodep.cmake
@@ -0,0 +1,9 @@
+enable_language(C)
+
+add_executable(exe main.c)
+
+install(TARGETS exe
+ RUNTIME_DEPENDENCIES
+ PRE_EXCLUDE_REGEXES ".*"
+ FRAMEWORK DESTINATION fw
+ )
diff --git a/Tests/RunCMake/install/TARGETS-RUNTIME_DEPENDENCIES-unsupported-result.txt b/Tests/RunCMake/install/TARGETS-RUNTIME_DEPENDENCIES-unsupported-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/install/TARGETS-RUNTIME_DEPENDENCIES-unsupported-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/install/TARGETS-RUNTIME_DEPENDENCIES-unsupported-stderr.txt b/Tests/RunCMake/install/TARGETS-RUNTIME_DEPENDENCIES-unsupported-stderr.txt
new file mode 100644
index 0000000..c098a4c
--- /dev/null
+++ b/Tests/RunCMake/install/TARGETS-RUNTIME_DEPENDENCIES-unsupported-stderr.txt
@@ -0,0 +1,5 @@
+^CMake Error at TARGETS-RUNTIME_DEPENDENCIES-unsupported\.cmake:[0-9]+ \(install\):
+ install TARGETS RUNTIME_DEPENDENCIES is not supported on system "[^
+]*"
+Call Stack \(most recent call first\):
+ CMakeLists\.txt:[0-9]+ \(include\)$
diff --git a/Tests/RunCMake/install/TARGETS-RUNTIME_DEPENDENCIES-unsupported.cmake b/Tests/RunCMake/install/TARGETS-RUNTIME_DEPENDENCIES-unsupported.cmake
new file mode 100644
index 0000000..36b2eb7
--- /dev/null
+++ b/Tests/RunCMake/install/TARGETS-RUNTIME_DEPENDENCIES-unsupported.cmake
@@ -0,0 +1,4 @@
+enable_language(C)
+
+add_executable(exe main.c)
+install(TARGETS exe RUNTIME_DEPENDENCIES)
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)