summaryrefslogtreecommitdiffstats
path: root/Tests/ExportImport
diff options
context:
space:
mode:
authorKyle Edwards <kyle.edwards@kitware.com>2021-06-02 13:46:37 (GMT)
committerKyle Edwards <kyle.edwards@kitware.com>2021-06-04 14:07:38 (GMT)
commit0c3c6acaff7e59712bdfc6ef66292ccebe8c5bcb (patch)
tree11b52b405e15ae0b8ab2790a7a255fb8367ba7bc /Tests/ExportImport
parent4910132d8c94ac2c08fddd3fafc79585e7423362 (diff)
downloadCMake-0c3c6acaff7e59712bdfc6ef66292ccebe8c5bcb.zip
CMake-0c3c6acaff7e59712bdfc6ef66292ccebe8c5bcb.tar.gz
CMake-0c3c6acaff7e59712bdfc6ef66292ccebe8c5bcb.tar.bz2
Tests: Add tests for new options
Diffstat (limited to 'Tests/ExportImport')
-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
17 files changed, 328 insertions, 34 deletions
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;
+}