summaryrefslogtreecommitdiffstats
path: root/Tests/RunCMake/install
diff options
context:
space:
mode:
Diffstat (limited to 'Tests/RunCMake/install')
-rw-r--r--Tests/RunCMake/install/CMP0062-NEW-result.txt1
-rw-r--r--Tests/RunCMake/install/CMP0062-NEW-stderr.txt11
-rw-r--r--Tests/RunCMake/install/CMP0062-NEW.cmake6
-rw-r--r--Tests/RunCMake/install/CMP0062-OLD-result.txt1
-rw-r--r--Tests/RunCMake/install/CMP0062-OLD-stderr.txt10
-rw-r--r--Tests/RunCMake/install/CMP0062-OLD.cmake6
-rw-r--r--Tests/RunCMake/install/CMP0062-WARN-result.txt1
-rw-r--r--Tests/RunCMake/install/CMP0062-WARN-stderr.txt16
-rw-r--r--Tests/RunCMake/install/CMP0062-WARN.cmake5
-rw-r--r--Tests/RunCMake/install/CMP0087-NEW-check.cmake7
-rw-r--r--Tests/RunCMake/install/CMP0087-NEW.cmake3
-rw-r--r--Tests/RunCMake/install/CMP0087-NEW/CMakeLists.txt7
-rw-r--r--Tests/RunCMake/install/CMP0087-OLD-check.cmake8
-rw-r--r--Tests/RunCMake/install/CMP0087-OLD.cmake3
-rw-r--r--Tests/RunCMake/install/CMP0087-OLD/CMakeLists.txt6
-rw-r--r--Tests/RunCMake/install/CMP0087-WARN-stderr.txt5
-rw-r--r--Tests/RunCMake/install/CMP0087-WARN.cmake2
-rw-r--r--Tests/RunCMake/install/CMakeLists.txt6
-rw-r--r--Tests/RunCMake/install/DIRECTORY-DESTINATION-TYPE-result.txt1
-rw-r--r--Tests/RunCMake/install/DIRECTORY-DESTINATION-TYPE-stderr.txt5
-rw-r--r--Tests/RunCMake/install/DIRECTORY-DESTINATION-TYPE.cmake1
-rw-r--r--Tests/RunCMake/install/DIRECTORY-DESTINATION-bad-result.txt1
-rw-r--r--Tests/RunCMake/install/DIRECTORY-DESTINATION-bad-stderr.txt6
-rw-r--r--Tests/RunCMake/install/DIRECTORY-DESTINATION-bad.cmake1
-rw-r--r--Tests/RunCMake/install/DIRECTORY-DIRECTORY-bad-result.txt1
-rw-r--r--Tests/RunCMake/install/DIRECTORY-DIRECTORY-bad-stderr.txt6
-rw-r--r--Tests/RunCMake/install/DIRECTORY-DIRECTORY-bad.cmake1
-rw-r--r--Tests/RunCMake/install/DIRECTORY-MESSAGE_NEVER-check.cmake13
-rw-r--r--Tests/RunCMake/install/DIRECTORY-MESSAGE_NEVER.cmake3
-rw-r--r--Tests/RunCMake/install/DIRECTORY-OPTIONAL-all-check.cmake1
-rw-r--r--Tests/RunCMake/install/DIRECTORY-OPTIONAL.cmake1
-rw-r--r--Tests/RunCMake/install/DIRECTORY-PATTERN-MESSAGE_NEVER-result.txt1
-rw-r--r--Tests/RunCMake/install/DIRECTORY-PATTERN-MESSAGE_NEVER-stderr.txt4
-rw-r--r--Tests/RunCMake/install/DIRECTORY-PATTERN-MESSAGE_NEVER.cmake1
-rw-r--r--Tests/RunCMake/install/DIRECTORY-PATTERN-all-check.cmake1
-rw-r--r--Tests/RunCMake/install/DIRECTORY-PATTERN.cmake36
-rw-r--r--Tests/RunCMake/install/DIRECTORY-TYPE-Cache-all-check.cmake42
-rw-r--r--Tests/RunCMake/install/DIRECTORY-TYPE-Cache.cmake13
-rw-r--r--Tests/RunCMake/install/DIRECTORY-TYPE-CacheDependent-all-check.cmake24
-rw-r--r--Tests/RunCMake/install/DIRECTORY-TYPE-CacheDependent.cmake7
-rw-r--r--Tests/RunCMake/install/DIRECTORY-TYPE-all-check.cmake42
-rw-r--r--Tests/RunCMake/install/DIRECTORY-TYPE.cmake13
-rw-r--r--Tests/RunCMake/install/DIRECTORY-message-check.cmake28
-rw-r--r--Tests/RunCMake/install/DIRECTORY-message-lazy-check.cmake24
-rw-r--r--Tests/RunCMake/install/DIRECTORY-message-lazy.cmake3
-rw-r--r--Tests/RunCMake/install/DIRECTORY-message.cmake3
-rw-r--r--Tests/RunCMake/install/Deprecated-all-check.cmake1
-rw-r--r--Tests/RunCMake/install/Deprecated.cmake13
-rw-r--r--Tests/RunCMake/install/EXPORT-OldIFace.cmake8
-rw-r--r--Tests/RunCMake/install/EXPORT-OldIFace/CMakeLists.txt2
-rw-r--r--Tests/RunCMake/install/FILES-DESTINATION-TYPE-result.txt1
-rw-r--r--Tests/RunCMake/install/FILES-DESTINATION-TYPE-stderr.txt5
-rw-r--r--Tests/RunCMake/install/FILES-DESTINATION-TYPE.cmake1
-rw-r--r--Tests/RunCMake/install/FILES-DESTINATION-bad-result.txt1
-rw-r--r--Tests/RunCMake/install/FILES-DESTINATION-bad-stderr.txt6
-rw-r--r--Tests/RunCMake/install/FILES-DESTINATION-bad.cmake1
-rw-r--r--Tests/RunCMake/install/FILES-EXCLUDE_FROM_ALL-all-check.cmake1
-rw-r--r--Tests/RunCMake/install/FILES-EXCLUDE_FROM_ALL-exc-check.cmake1
-rw-r--r--Tests/RunCMake/install/FILES-EXCLUDE_FROM_ALL-uns-check.cmake1
-rw-r--r--Tests/RunCMake/install/FILES-EXCLUDE_FROM_ALL.cmake3
-rw-r--r--Tests/RunCMake/install/FILES-OPTIONAL-all-check.cmake1
-rw-r--r--Tests/RunCMake/install/FILES-OPTIONAL.cmake1
-rw-r--r--Tests/RunCMake/install/FILES-PERMISSIONS-all-check.cmake1
-rw-r--r--Tests/RunCMake/install/FILES-PERMISSIONS.cmake5
-rw-r--r--Tests/RunCMake/install/FILES-TARGET_OBJECTS-all-check.cmake1
-rw-r--r--Tests/RunCMake/install/FILES-TARGET_OBJECTS.cmake3
-rw-r--r--Tests/RunCMake/install/FILES-TYPE-Cache-all-check.cmake29
-rw-r--r--Tests/RunCMake/install/FILES-TYPE-Cache.cmake13
-rw-r--r--Tests/RunCMake/install/FILES-TYPE-CacheDependent-all-check.cmake17
-rw-r--r--Tests/RunCMake/install/FILES-TYPE-CacheDependent.cmake7
-rw-r--r--Tests/RunCMake/install/FILES-TYPE-all-check.cmake29
-rw-r--r--Tests/RunCMake/install/FILES-TYPE.cmake13
-rw-r--r--Tests/RunCMake/install/InstallRequiredSystemLibraries-stderr.txt1
-rw-r--r--Tests/RunCMake/install/InstallRequiredSystemLibraries.cmake10
-rw-r--r--Tests/RunCMake/install/PRE_POST_INSTALL_SCRIPT-all-check.cmake1
-rw-r--r--Tests/RunCMake/install/PRE_POST_INSTALL_SCRIPT.cmake7
-rw-r--r--Tests/RunCMake/install/RunCMakeTest.cmake194
-rw-r--r--Tests/RunCMake/install/SCRIPT-COMPONENT-all-check.cmake1
-rw-r--r--Tests/RunCMake/install/SCRIPT-COMPONENT-dev-check.cmake1
-rw-r--r--Tests/RunCMake/install/SCRIPT-COMPONENT-uns-check.cmake1
-rw-r--r--Tests/RunCMake/install/SCRIPT-COMPONENT.cmake5
-rw-r--r--Tests/RunCMake/install/SCRIPT-all-check.cmake1
-rw-r--r--Tests/RunCMake/install/SCRIPT.cmake4
-rw-r--r--Tests/RunCMake/install/SkipInstallRulesNoWarning1-check.cmake9
-rw-r--r--Tests/RunCMake/install/SkipInstallRulesNoWarning1.cmake1
-rw-r--r--Tests/RunCMake/install/SkipInstallRulesNoWarning2-check.cmake9
-rw-r--r--Tests/RunCMake/install/SkipInstallRulesNoWarning2.cmake1
-rw-r--r--Tests/RunCMake/install/SkipInstallRulesWarning-check.cmake9
-rw-r--r--Tests/RunCMake/install/SkipInstallRulesWarning-stderr.txt3
-rw-r--r--Tests/RunCMake/install/SkipInstallRulesWarning.cmake2
-rw-r--r--Tests/RunCMake/install/TARGETS-Apple-Defaults-result.txt1
-rw-r--r--Tests/RunCMake/install/TARGETS-Apple-Defaults-stderr.txt12
-rw-r--r--Tests/RunCMake/install/TARGETS-Apple-Defaults.cmake8
-rw-r--r--Tests/RunCMake/install/TARGETS-CONFIGURATIONS-all-check.cmake1
-rw-r--r--Tests/RunCMake/install/TARGETS-CONFIGURATIONS.cmake2
-rw-r--r--Tests/RunCMake/install/TARGETS-DESTINATION-bad-result.txt1
-rw-r--r--Tests/RunCMake/install/TARGETS-DESTINATION-bad-stderr.txt6
-rw-r--r--Tests/RunCMake/install/TARGETS-DESTINATION-bad.cmake3
-rw-r--r--Tests/RunCMake/install/TARGETS-Defaults-Cache-all-check.cmake46
-rw-r--r--Tests/RunCMake/install/TARGETS-Defaults-Cache-stderr.txt2
-rw-r--r--Tests/RunCMake/install/TARGETS-Defaults-Cache.cmake20
-rw-r--r--Tests/RunCMake/install/TARGETS-Defaults-all-check.cmake52
-rw-r--r--Tests/RunCMake/install/TARGETS-Defaults-stderr.txt2
-rw-r--r--Tests/RunCMake/install/TARGETS-Defaults.cmake28
-rw-r--r--Tests/RunCMake/install/TARGETS-EXCLUDE_FROM_ALL-all-check.cmake1
-rw-r--r--Tests/RunCMake/install/TARGETS-EXCLUDE_FROM_ALL-exc-check.cmake1
-rw-r--r--Tests/RunCMake/install/TARGETS-EXCLUDE_FROM_ALL-uns-check.cmake1
-rw-r--r--Tests/RunCMake/install/TARGETS-EXCLUDE_FROM_ALL.cmake5
-rw-r--r--Tests/RunCMake/install/TARGETS-FILE_RPATH_CHANGE-check-common.cmake30
-rw-r--r--Tests/RunCMake/install/TARGETS-FILE_RPATH_CHANGE-new_rpath-check.cmake63
-rw-r--r--Tests/RunCMake/install/TARGETS-FILE_RPATH_CHANGE-new_rpath-stderr.txt23
-rw-r--r--Tests/RunCMake/install/TARGETS-FILE_RPATH_CHANGE-new_rpath.cmake72
-rw-r--r--Tests/RunCMake/install/TARGETS-FILE_RPATH_CHANGE-old_rpath-check.cmake15
-rw-r--r--Tests/RunCMake/install/TARGETS-FILE_RPATH_CHANGE-old_rpath.cmake18
-rw-r--r--Tests/RunCMake/install/TARGETS-ImportedGlobal-result.txt1
-rw-r--r--Tests/RunCMake/install/TARGETS-ImportedGlobal-stderr.txt4
-rw-r--r--Tests/RunCMake/install/TARGETS-ImportedGlobal.cmake3
-rw-r--r--Tests/RunCMake/install/TARGETS-InstallFromSubDir-all-check.cmake1
-rw-r--r--Tests/RunCMake/install/TARGETS-InstallFromSubDir.cmake4
-rw-r--r--Tests/RunCMake/install/TARGETS-InstallFromSubDir/CMakeLists.txt1
-rw-r--r--Tests/RunCMake/install/TARGETS-NAMELINK_COMPONENT-all-check.cmake73
-rw-r--r--Tests/RunCMake/install/TARGETS-NAMELINK_COMPONENT-bad-all-result.txt1
-rw-r--r--Tests/RunCMake/install/TARGETS-NAMELINK_COMPONENT-bad-all-stderr.txt5
-rw-r--r--Tests/RunCMake/install/TARGETS-NAMELINK_COMPONENT-bad-all.cmake9
-rw-r--r--Tests/RunCMake/install/TARGETS-NAMELINK_COMPONENT-bad-exc-result.txt1
-rw-r--r--Tests/RunCMake/install/TARGETS-NAMELINK_COMPONENT-bad-exc-stderr.txt5
-rw-r--r--Tests/RunCMake/install/TARGETS-NAMELINK_COMPONENT-bad-exc.cmake10
-rw-r--r--Tests/RunCMake/install/TARGETS-NAMELINK_COMPONENT-dev-check.cmake11
-rw-r--r--Tests/RunCMake/install/TARGETS-NAMELINK_COMPONENT-lib-check.cmake50
-rw-r--r--Tests/RunCMake/install/TARGETS-NAMELINK_COMPONENT-uns-check.cmake38
-rw-r--r--Tests/RunCMake/install/TARGETS-NAMELINK_COMPONENT.cmake68
-rw-r--r--Tests/RunCMake/install/TARGETS-OPTIONAL-all-check.cmake1
-rw-r--r--Tests/RunCMake/install/TARGETS-OPTIONAL.cmake4
-rw-r--r--Tests/RunCMake/install/TARGETS-OUTPUT_NAME-all-check.cmake13
-rw-r--r--Tests/RunCMake/install/TARGETS-OUTPUT_NAME.cmake27
-rw-r--r--Tests/RunCMake/install/TARGETS-Parts-all-check.cmake1
-rw-r--r--Tests/RunCMake/install/TARGETS-Parts.cmake7
-rw-r--r--Tests/RunCMake/install/TARGETS-RPATH-all-check.cmake14
-rw-r--r--Tests/RunCMake/install/TARGETS-RPATH.cmake14
-rw-r--r--Tests/RunCMake/install/dir/empty.txt0
-rw-r--r--Tests/RunCMake/install/empty.c0
-rw-r--r--Tests/RunCMake/install/file-GET_RUNTIME_DEPENDENCIES-badargs1-result.txt1
-rw-r--r--Tests/RunCMake/install/file-GET_RUNTIME_DEPENDENCIES-badargs1-stderr.txt18
-rw-r--r--Tests/RunCMake/install/file-GET_RUNTIME_DEPENDENCIES-badargs1.cmake2
-rw-r--r--Tests/RunCMake/install/file-GET_RUNTIME_DEPENDENCIES-badargs2-result.txt1
-rw-r--r--Tests/RunCMake/install/file-GET_RUNTIME_DEPENDENCIES-badargs2-stderr.txt23
-rw-r--r--Tests/RunCMake/install/file-GET_RUNTIME_DEPENDENCIES-badargs2.cmake15
-rw-r--r--Tests/RunCMake/install/file-GET_RUNTIME_DEPENDENCIES-linux-all-check.cmake44
-rw-r--r--Tests/RunCMake/install/file-GET_RUNTIME_DEPENDENCIES-linux-all-stderr.txt119
-rw-r--r--Tests/RunCMake/install/file-GET_RUNTIME_DEPENDENCIES-linux-conflict-all-result.txt1
-rw-r--r--Tests/RunCMake/install/file-GET_RUNTIME_DEPENDENCIES-linux-conflict-all-stderr.txt7
-rw-r--r--Tests/RunCMake/install/file-GET_RUNTIME_DEPENDENCIES-linux-conflict.cmake54
-rw-r--r--Tests/RunCMake/install/file-GET_RUNTIME_DEPENDENCIES-linux-notfile-all-result.txt1
-rw-r--r--Tests/RunCMake/install/file-GET_RUNTIME_DEPENDENCIES-linux-notfile-all-stderr.txt5
-rw-r--r--Tests/RunCMake/install/file-GET_RUNTIME_DEPENDENCIES-linux-notfile.cmake30
-rw-r--r--Tests/RunCMake/install/file-GET_RUNTIME_DEPENDENCIES-linux-unresolved-all-result.txt1
-rw-r--r--Tests/RunCMake/install/file-GET_RUNTIME_DEPENDENCIES-linux-unresolved-all-stderr.txt2
-rw-r--r--Tests/RunCMake/install/file-GET_RUNTIME_DEPENDENCIES-linux-unresolved.cmake18
-rw-r--r--Tests/RunCMake/install/file-GET_RUNTIME_DEPENDENCIES-linux.cmake169
-rw-r--r--Tests/RunCMake/install/file-GET_RUNTIME_DEPENDENCIES-linux/topexe.c9
-rw-r--r--Tests/RunCMake/install/file-GET_RUNTIME_DEPENDENCIES-linux/toplib.c8
-rw-r--r--Tests/RunCMake/install/file-GET_RUNTIME_DEPENDENCIES-macos-all-check.cmake157
-rw-r--r--Tests/RunCMake/install/file-GET_RUNTIME_DEPENDENCIES-macos-conflict-all-result.txt1
-rw-r--r--Tests/RunCMake/install/file-GET_RUNTIME_DEPENDENCIES-macos-conflict-all-stderr.txt7
-rw-r--r--Tests/RunCMake/install/file-GET_RUNTIME_DEPENDENCIES-macos-conflict.cmake55
-rw-r--r--Tests/RunCMake/install/file-GET_RUNTIME_DEPENDENCIES-macos-notfile-all-result.txt1
-rw-r--r--Tests/RunCMake/install/file-GET_RUNTIME_DEPENDENCIES-macos-notfile-all-stderr.txt5
-rw-r--r--Tests/RunCMake/install/file-GET_RUNTIME_DEPENDENCIES-macos-notfile.cmake30
-rw-r--r--Tests/RunCMake/install/file-GET_RUNTIME_DEPENDENCIES-macos-unresolved-all-result.txt1
-rw-r--r--Tests/RunCMake/install/file-GET_RUNTIME_DEPENDENCIES-macos-unresolved-all-stderr.txt2
-rw-r--r--Tests/RunCMake/install/file-GET_RUNTIME_DEPENDENCIES-macos-unresolved.cmake18
-rw-r--r--Tests/RunCMake/install/file-GET_RUNTIME_DEPENDENCIES-macos.cmake216
-rw-r--r--Tests/RunCMake/install/file-GET_RUNTIME_DEPENDENCIES-macos/topexe.c7
-rw-r--r--Tests/RunCMake/install/file-GET_RUNTIME_DEPENDENCIES-macos/toplib.c6
-rw-r--r--Tests/RunCMake/install/file-GET_RUNTIME_DEPENDENCIES-project-stderr.txt13
-rw-r--r--Tests/RunCMake/install/file-GET_RUNTIME_DEPENDENCIES-project.cmake1
-rw-r--r--Tests/RunCMake/install/file-GET_RUNTIME_DEPENDENCIES-unsupported-result.txt1
-rw-r--r--Tests/RunCMake/install/file-GET_RUNTIME_DEPENDENCIES-unsupported-stderr.txt5
-rw-r--r--Tests/RunCMake/install/file-GET_RUNTIME_DEPENDENCIES-unsupported.cmake2
-rw-r--r--Tests/RunCMake/install/file-GET_RUNTIME_DEPENDENCIES-windows-all-check.cmake38
-rw-r--r--Tests/RunCMake/install/file-GET_RUNTIME_DEPENDENCIES-windows-conflict-all-result.txt1
-rw-r--r--Tests/RunCMake/install/file-GET_RUNTIME_DEPENDENCIES-windows-conflict-all-stderr.txt7
-rw-r--r--Tests/RunCMake/install/file-GET_RUNTIME_DEPENDENCIES-windows-conflict.cmake47
-rw-r--r--Tests/RunCMake/install/file-GET_RUNTIME_DEPENDENCIES-windows-notfile-all-result.txt1
-rw-r--r--Tests/RunCMake/install/file-GET_RUNTIME_DEPENDENCIES-windows-notfile-all-stderr.txt5
-rw-r--r--Tests/RunCMake/install/file-GET_RUNTIME_DEPENDENCIES-windows-notfile.cmake28
-rw-r--r--Tests/RunCMake/install/file-GET_RUNTIME_DEPENDENCIES-windows-unresolved-all-result.txt1
-rw-r--r--Tests/RunCMake/install/file-GET_RUNTIME_DEPENDENCIES-windows-unresolved-all-stderr.txt2
-rw-r--r--Tests/RunCMake/install/file-GET_RUNTIME_DEPENDENCIES-windows-unresolved.cmake18
-rw-r--r--Tests/RunCMake/install/file-GET_RUNTIME_DEPENDENCIES-windows.cmake114
-rw-r--r--Tests/RunCMake/install/file-GET_RUNTIME_DEPENDENCIES-windows/topexe.c7
-rw-r--r--Tests/RunCMake/install/file-GET_RUNTIME_DEPENDENCIES-windows/toplib.c6
-rw-r--r--Tests/RunCMake/install/install_script.cmake5
-rw-r--r--Tests/RunCMake/install/main.c4
-rw-r--r--Tests/RunCMake/install/obj1.c7
-rw-r--r--Tests/RunCMake/install/obj1.h6
-rw-r--r--Tests/RunCMake/install/obj2.c4
-rw-r--r--Tests/RunCMake/install/obj2.h6
-rw-r--r--Tests/RunCMake/install/obj3.c7
-rw-r--r--Tests/RunCMake/install/obj3.h6
-rw-r--r--Tests/RunCMake/install/obj4.c7
-rw-r--r--Tests/RunCMake/install/obj4.h6
-rw-r--r--Tests/RunCMake/install/obj5.c7
-rw-r--r--Tests/RunCMake/install/obj5.h6
-rw-r--r--Tests/RunCMake/install/pattern/empty.c0
-rw-r--r--Tests/RunCMake/install/pattern/empty.h0
-rw-r--r--Tests/RunCMake/install/pattern/empty.txt0
-rw-r--r--Tests/RunCMake/install/postinstall.cmake1
-rw-r--r--Tests/RunCMake/install/preinstall.cmake1
-rwxr-xr-xTests/RunCMake/install/script2
-rwxr-xr-xTests/RunCMake/install/script.bat1
-rw-r--r--Tests/RunCMake/install/testobj1.c9
212 files changed, 3007 insertions, 0 deletions
diff --git a/Tests/RunCMake/install/CMP0062-NEW-result.txt b/Tests/RunCMake/install/CMP0062-NEW-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/install/CMP0062-NEW-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/install/CMP0062-NEW-stderr.txt b/Tests/RunCMake/install/CMP0062-NEW-stderr.txt
new file mode 100644
index 0000000..b03f629
--- /dev/null
+++ b/Tests/RunCMake/install/CMP0062-NEW-stderr.txt
@@ -0,0 +1,11 @@
+CMake Error at CMP0062-NEW.cmake:[0-9]+ \(install\):
+ The file
+
+ .*Tests/RunCMake/install/CMP0062-NEW-build/exported.cmake
+
+ was generated by the export\(\) command. It may not be installed with the
+ install\(\) command. Use the install\(EXPORT\) mechanism instead. See the
+ cmake-packages\(7\) manual for more.
+
+Call Stack \(most recent call first\):
+ CMakeLists.txt:[0-9]+ \(include\)
diff --git a/Tests/RunCMake/install/CMP0062-NEW.cmake b/Tests/RunCMake/install/CMP0062-NEW.cmake
new file mode 100644
index 0000000..9e7a5fb
--- /dev/null
+++ b/Tests/RunCMake/install/CMP0062-NEW.cmake
@@ -0,0 +1,6 @@
+cmake_policy(VERSION 3.2)
+cmake_policy(SET CMP0062 NEW)
+
+add_library(iface INTERFACE)
+export(TARGETS iface FILE "${CMAKE_CURRENT_BINARY_DIR}/exported.cmake")
+install(FILES "${CMAKE_CURRENT_BINARY_DIR}/exported.cmake" DESTINATION cmake)
diff --git a/Tests/RunCMake/install/CMP0062-OLD-result.txt b/Tests/RunCMake/install/CMP0062-OLD-result.txt
new file mode 100644
index 0000000..573541a
--- /dev/null
+++ b/Tests/RunCMake/install/CMP0062-OLD-result.txt
@@ -0,0 +1 @@
+0
diff --git a/Tests/RunCMake/install/CMP0062-OLD-stderr.txt b/Tests/RunCMake/install/CMP0062-OLD-stderr.txt
new file mode 100644
index 0000000..de0b70f
--- /dev/null
+++ b/Tests/RunCMake/install/CMP0062-OLD-stderr.txt
@@ -0,0 +1,10 @@
+^CMake Deprecation Warning at CMP0062-OLD.cmake:[0-9]+ \(cmake_policy\):
+ The OLD behavior for policy CMP0062 will be removed from a future version
+ of CMake.
+
+ The cmake-policies\(7\) manual explains that the OLD behaviors of all
+ policies are deprecated and that a policy should be set to OLD only under
+ specific short-term circumstances. Projects should be ported to the NEW
+ behavior and not rely on setting a policy to OLD.
+Call Stack \(most recent call first\):
+ CMakeLists.txt:[0-9]+ \(include\)$
diff --git a/Tests/RunCMake/install/CMP0062-OLD.cmake b/Tests/RunCMake/install/CMP0062-OLD.cmake
new file mode 100644
index 0000000..8874923
--- /dev/null
+++ b/Tests/RunCMake/install/CMP0062-OLD.cmake
@@ -0,0 +1,6 @@
+cmake_policy(VERSION 3.2)
+cmake_policy(SET CMP0062 OLD)
+
+add_library(iface INTERFACE)
+export(TARGETS iface FILE "${CMAKE_CURRENT_BINARY_DIR}/exported.cmake")
+install(FILES "${CMAKE_CURRENT_BINARY_DIR}/exported.cmake" DESTINATION cmake)
diff --git a/Tests/RunCMake/install/CMP0062-WARN-result.txt b/Tests/RunCMake/install/CMP0062-WARN-result.txt
new file mode 100644
index 0000000..573541a
--- /dev/null
+++ b/Tests/RunCMake/install/CMP0062-WARN-result.txt
@@ -0,0 +1 @@
+0
diff --git a/Tests/RunCMake/install/CMP0062-WARN-stderr.txt b/Tests/RunCMake/install/CMP0062-WARN-stderr.txt
new file mode 100644
index 0000000..12ae745
--- /dev/null
+++ b/Tests/RunCMake/install/CMP0062-WARN-stderr.txt
@@ -0,0 +1,16 @@
+CMake Warning \(dev\) at CMP0062-WARN.cmake:[0-9]+ \(install\):
+ Policy CMP0062 is not set: Disallow install\(\) of export\(\) result. Run
+ "cmake --help-policy CMP0062" for policy details. Use the cmake_policy
+ command to set the policy and suppress this warning.
+
+ The file
+
+ .*Tests/RunCMake/install/CMP0062-WARN-build/exported.cmake
+
+ was generated by the export\(\) command. It should not be installed with the
+ install\(\) command. Use the install\(EXPORT\) mechanism instead. See the
+ cmake-packages\(7\) manual for more.
+
+Call Stack \(most recent call first\):
+ CMakeLists.txt:[0-9]+ \(include\)
+This warning is for project developers. Use -Wno-dev to suppress it.
diff --git a/Tests/RunCMake/install/CMP0062-WARN.cmake b/Tests/RunCMake/install/CMP0062-WARN.cmake
new file mode 100644
index 0000000..018f822
--- /dev/null
+++ b/Tests/RunCMake/install/CMP0062-WARN.cmake
@@ -0,0 +1,5 @@
+cmake_policy(VERSION 3.2)
+
+add_library(iface INTERFACE)
+export(TARGETS iface FILE "${CMAKE_CURRENT_BINARY_DIR}/exported.cmake")
+install(FILES "${CMAKE_CURRENT_BINARY_DIR}/exported.cmake" DESTINATION cmake)
diff --git a/Tests/RunCMake/install/CMP0087-NEW-check.cmake b/Tests/RunCMake/install/CMP0087-NEW-check.cmake
new file mode 100644
index 0000000..422c532
--- /dev/null
+++ b/Tests/RunCMake/install/CMP0087-NEW-check.cmake
@@ -0,0 +1,7 @@
+execute_process(COMMAND ${CMAKE_COMMAND} -P ${RunCMake_TEST_BINARY_DIR}/cmake_install.cmake
+ OUTPUT_VARIABLE out ERROR_VARIABLE err)
+if(NOT out MATCHES "-- Install configuration: .*-- codegenexlib")
+ string(REGEX REPLACE "\n" "\n " out " ${out}")
+ string(APPEND RunCMake_TEST_FAILED
+ "\"-- codegenexlib\" was not found:\n${out}")
+endif()
diff --git a/Tests/RunCMake/install/CMP0087-NEW.cmake b/Tests/RunCMake/install/CMP0087-NEW.cmake
new file mode 100644
index 0000000..0177960
--- /dev/null
+++ b/Tests/RunCMake/install/CMP0087-NEW.cmake
@@ -0,0 +1,3 @@
+# Need a new directory scope, not just a new policy scope
+# to test this correctly
+add_subdirectory(CMP0087-NEW)
diff --git a/Tests/RunCMake/install/CMP0087-NEW/CMakeLists.txt b/Tests/RunCMake/install/CMP0087-NEW/CMakeLists.txt
new file mode 100644
index 0000000..07b4589
--- /dev/null
+++ b/Tests/RunCMake/install/CMP0087-NEW/CMakeLists.txt
@@ -0,0 +1,7 @@
+# Note that it is the policy settings at the end of the directory
+# scope that will be used when deciding whether or not generator
+# expressions should be evaluated in the installed code.
+cmake_policy(VERSION 3.13)
+cmake_policy(SET CMP0087 NEW)
+add_library( codegenexlib INTERFACE )
+install(CODE "message( STATUS \"$<TARGET_PROPERTY:codegenexlib,NAME>\")")
diff --git a/Tests/RunCMake/install/CMP0087-OLD-check.cmake b/Tests/RunCMake/install/CMP0087-OLD-check.cmake
new file mode 100644
index 0000000..c5984bc
--- /dev/null
+++ b/Tests/RunCMake/install/CMP0087-OLD-check.cmake
@@ -0,0 +1,8 @@
+execute_process(COMMAND ${CMAKE_COMMAND} -P ${RunCMake_TEST_BINARY_DIR}/cmake_install.cmake
+ OUTPUT_VARIABLE out ERROR_VARIABLE err)
+
+if(NOT out MATCHES "-- Install configuration: .*-- \\$<TARGET_PROPERTY:codegenexlib,NAME>")
+ string(REGEX REPLACE "\n" "\n " out " ${out}")
+ string(APPEND RunCMake_TEST_FAILED
+ "\"-- $<TARGET_PROPERTY:codegenexlib,NAME>\" was not found:\n${out}")
+endif()
diff --git a/Tests/RunCMake/install/CMP0087-OLD.cmake b/Tests/RunCMake/install/CMP0087-OLD.cmake
new file mode 100644
index 0000000..e7ed4ee
--- /dev/null
+++ b/Tests/RunCMake/install/CMP0087-OLD.cmake
@@ -0,0 +1,3 @@
+# Need a new directory scope, not just a new policy scope
+# to test this correctly
+add_subdirectory(CMP0087-OLD)
diff --git a/Tests/RunCMake/install/CMP0087-OLD/CMakeLists.txt b/Tests/RunCMake/install/CMP0087-OLD/CMakeLists.txt
new file mode 100644
index 0000000..b1d4e2e
--- /dev/null
+++ b/Tests/RunCMake/install/CMP0087-OLD/CMakeLists.txt
@@ -0,0 +1,6 @@
+# Note that it is the policy settings at the end of the directory
+# scope that will be used when deciding whether or not generator
+# expressions should be evaluated in the installed code.
+cmake_policy(VERSION 3.13)
+cmake_policy(SET CMP0087 OLD)
+install(CODE "message( STATUS \"$<TARGET_PROPERTY:codegenexlib,NAME>\")")
diff --git a/Tests/RunCMake/install/CMP0087-WARN-stderr.txt b/Tests/RunCMake/install/CMP0087-WARN-stderr.txt
new file mode 100644
index 0000000..75fbf2c
--- /dev/null
+++ b/Tests/RunCMake/install/CMP0087-WARN-stderr.txt
@@ -0,0 +1,5 @@
+CMake Warning (dev) in CMakeLists.txt:
+ Policy CMP0087 is not set: Install CODE|SCRIPT allow the use of generator
+ expressions. Run "cmake --help-policy CMP0087" for policy details. Use
+ the cmake_policy command to set the policy and suppress this warning.
+This warning is for project developers. Use -Wno-dev to suppress it.
diff --git a/Tests/RunCMake/install/CMP0087-WARN.cmake b/Tests/RunCMake/install/CMP0087-WARN.cmake
new file mode 100644
index 0000000..3b8513d
--- /dev/null
+++ b/Tests/RunCMake/install/CMP0087-WARN.cmake
@@ -0,0 +1,2 @@
+add_library( codegenexlib INTERFACE )
+install(CODE "message( STATUS \"$<TARGET_PROPERTY:codegenexlib,NAME>\")")
diff --git a/Tests/RunCMake/install/CMakeLists.txt b/Tests/RunCMake/install/CMakeLists.txt
new file mode 100644
index 0000000..c7e99ad
--- /dev/null
+++ b/Tests/RunCMake/install/CMakeLists.txt
@@ -0,0 +1,6 @@
+cmake_minimum_required(VERSION 3.4)
+if(RunCMake_TEST MATCHES "^file-GET_RUNTIME_DEPENDENCIES")
+ cmake_policy(SET CMP0087 NEW)
+endif()
+project(${RunCMake_TEST} NONE)
+include(${RunCMake_TEST}.cmake)
diff --git a/Tests/RunCMake/install/DIRECTORY-DESTINATION-TYPE-result.txt b/Tests/RunCMake/install/DIRECTORY-DESTINATION-TYPE-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/install/DIRECTORY-DESTINATION-TYPE-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/install/DIRECTORY-DESTINATION-TYPE-stderr.txt b/Tests/RunCMake/install/DIRECTORY-DESTINATION-TYPE-stderr.txt
new file mode 100644
index 0000000..c847c43
--- /dev/null
+++ b/Tests/RunCMake/install/DIRECTORY-DESTINATION-TYPE-stderr.txt
@@ -0,0 +1,5 @@
+^CMake Error at DIRECTORY-DESTINATION-TYPE\.cmake:[0-9]+ \(install\):
+ install DIRECTORY given both TYPE and DESTINATION arguments\. You may only
+ specify one\.
+Call Stack \(most recent call first\):
+ CMakeLists\.txt:[0-9]+ \(include\)$
diff --git a/Tests/RunCMake/install/DIRECTORY-DESTINATION-TYPE.cmake b/Tests/RunCMake/install/DIRECTORY-DESTINATION-TYPE.cmake
new file mode 100644
index 0000000..4404d6b
--- /dev/null
+++ b/Tests/RunCMake/install/DIRECTORY-DESTINATION-TYPE.cmake
@@ -0,0 +1 @@
+install(DIRECTORY dir TYPE BIN DESTINATION mybin)
diff --git a/Tests/RunCMake/install/DIRECTORY-DESTINATION-bad-result.txt b/Tests/RunCMake/install/DIRECTORY-DESTINATION-bad-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/install/DIRECTORY-DESTINATION-bad-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/install/DIRECTORY-DESTINATION-bad-stderr.txt b/Tests/RunCMake/install/DIRECTORY-DESTINATION-bad-stderr.txt
new file mode 100644
index 0000000..9844158
--- /dev/null
+++ b/Tests/RunCMake/install/DIRECTORY-DESTINATION-bad-stderr.txt
@@ -0,0 +1,6 @@
+CMake Error:
+ Error evaluating generator expression:
+
+ \$<NOTAGENEX>
+
+ Expression did not evaluate to a known generator expression
diff --git a/Tests/RunCMake/install/DIRECTORY-DESTINATION-bad.cmake b/Tests/RunCMake/install/DIRECTORY-DESTINATION-bad.cmake
new file mode 100644
index 0000000..f050cdf
--- /dev/null
+++ b/Tests/RunCMake/install/DIRECTORY-DESTINATION-bad.cmake
@@ -0,0 +1 @@
+install(DIRECTORY dir DESTINATION $<NOTAGENEX>)
diff --git a/Tests/RunCMake/install/DIRECTORY-DIRECTORY-bad-result.txt b/Tests/RunCMake/install/DIRECTORY-DIRECTORY-bad-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/install/DIRECTORY-DIRECTORY-bad-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/install/DIRECTORY-DIRECTORY-bad-stderr.txt b/Tests/RunCMake/install/DIRECTORY-DIRECTORY-bad-stderr.txt
new file mode 100644
index 0000000..9844158
--- /dev/null
+++ b/Tests/RunCMake/install/DIRECTORY-DIRECTORY-bad-stderr.txt
@@ -0,0 +1,6 @@
+CMake Error:
+ Error evaluating generator expression:
+
+ \$<NOTAGENEX>
+
+ Expression did not evaluate to a known generator expression
diff --git a/Tests/RunCMake/install/DIRECTORY-DIRECTORY-bad.cmake b/Tests/RunCMake/install/DIRECTORY-DIRECTORY-bad.cmake
new file mode 100644
index 0000000..ec0436d
--- /dev/null
+++ b/Tests/RunCMake/install/DIRECTORY-DIRECTORY-bad.cmake
@@ -0,0 +1 @@
+install(DIRECTORY $<NOTAGENEX> DESTINATION .)
diff --git a/Tests/RunCMake/install/DIRECTORY-MESSAGE_NEVER-check.cmake b/Tests/RunCMake/install/DIRECTORY-MESSAGE_NEVER-check.cmake
new file mode 100644
index 0000000..3605163
--- /dev/null
+++ b/Tests/RunCMake/install/DIRECTORY-MESSAGE_NEVER-check.cmake
@@ -0,0 +1,13 @@
+file(REMOVE_RECURSE ${RunCMake_TEST_BINARY_DIR}/prefix)
+execute_process(COMMAND ${CMAKE_COMMAND} -P ${RunCMake_TEST_BINARY_DIR}/cmake_install.cmake
+ OUTPUT_VARIABLE out ERROR_VARIABLE err)
+if(out MATCHES "-- Installing: [^\n]*prefix/dir")
+ string(REGEX REPLACE "\n" "\n " out " ${out}")
+ string(APPEND RunCMake_TEST_FAILED
+ "Installation output was not quiet:\n${out}")
+endif()
+set(f ${RunCMake_TEST_BINARY_DIR}/prefix/dir/empty.txt)
+if(NOT EXISTS "${f}")
+ string(APPEND RunCMake_TEST_FAILED
+ "File was not installed:\n ${f}\n")
+endif()
diff --git a/Tests/RunCMake/install/DIRECTORY-MESSAGE_NEVER.cmake b/Tests/RunCMake/install/DIRECTORY-MESSAGE_NEVER.cmake
new file mode 100644
index 0000000..eefb837
--- /dev/null
+++ b/Tests/RunCMake/install/DIRECTORY-MESSAGE_NEVER.cmake
@@ -0,0 +1,3 @@
+set(CMAKE_INSTALL_MESSAGE "ALWAYS")
+set(CMAKE_INSTALL_PREFIX "${CMAKE_BINARY_DIR}/prefix")
+install(DIRECTORY dir/ DESTINATION dir MESSAGE_NEVER)
diff --git a/Tests/RunCMake/install/DIRECTORY-OPTIONAL-all-check.cmake b/Tests/RunCMake/install/DIRECTORY-OPTIONAL-all-check.cmake
new file mode 100644
index 0000000..c14998e
--- /dev/null
+++ b/Tests/RunCMake/install/DIRECTORY-OPTIONAL-all-check.cmake
@@ -0,0 +1 @@
+check_installed([[^dir;dir/empty.txt$]])
diff --git a/Tests/RunCMake/install/DIRECTORY-OPTIONAL.cmake b/Tests/RunCMake/install/DIRECTORY-OPTIONAL.cmake
new file mode 100644
index 0000000..e57aab0
--- /dev/null
+++ b/Tests/RunCMake/install/DIRECTORY-OPTIONAL.cmake
@@ -0,0 +1 @@
+install(DIRECTORY dir/ noexist/ DESTINATION dir OPTIONAL)
diff --git a/Tests/RunCMake/install/DIRECTORY-PATTERN-MESSAGE_NEVER-result.txt b/Tests/RunCMake/install/DIRECTORY-PATTERN-MESSAGE_NEVER-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/install/DIRECTORY-PATTERN-MESSAGE_NEVER-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/install/DIRECTORY-PATTERN-MESSAGE_NEVER-stderr.txt b/Tests/RunCMake/install/DIRECTORY-PATTERN-MESSAGE_NEVER-stderr.txt
new file mode 100644
index 0000000..c8074e9
--- /dev/null
+++ b/Tests/RunCMake/install/DIRECTORY-PATTERN-MESSAGE_NEVER-stderr.txt
@@ -0,0 +1,4 @@
+CMake Error at DIRECTORY-PATTERN-MESSAGE_NEVER.cmake:[0-9]+ \(install\):
+ install DIRECTORY does not allow "MESSAGE_NEVER" after PATTERN or REGEX.
+Call Stack \(most recent call first\):
+ CMakeLists\.txt:[0-9]+ \(include\)
diff --git a/Tests/RunCMake/install/DIRECTORY-PATTERN-MESSAGE_NEVER.cmake b/Tests/RunCMake/install/DIRECTORY-PATTERN-MESSAGE_NEVER.cmake
new file mode 100644
index 0000000..de844f7
--- /dev/null
+++ b/Tests/RunCMake/install/DIRECTORY-PATTERN-MESSAGE_NEVER.cmake
@@ -0,0 +1 @@
+install(DIRECTORY src DESTINATION src PATTERN *.txt MESSAGE_NEVER)
diff --git a/Tests/RunCMake/install/DIRECTORY-PATTERN-all-check.cmake b/Tests/RunCMake/install/DIRECTORY-PATTERN-all-check.cmake
new file mode 100644
index 0000000..7a20edc
--- /dev/null
+++ b/Tests/RunCMake/install/DIRECTORY-PATTERN-all-check.cmake
@@ -0,0 +1 @@
+check_installed([[^dir1;dir1/empty\.c;dir1/empty\.h;dir2;dir2/pattern;dir2/pattern/empty\.txt;dir3;dir3/empty\.c;dir3/empty\.h;dir3/empty\.txt;dir4;dir4/empty\.c;dir4/empty\.h;dir4/empty\.txt;empty$]])
diff --git a/Tests/RunCMake/install/DIRECTORY-PATTERN.cmake b/Tests/RunCMake/install/DIRECTORY-PATTERN.cmake
new file mode 100644
index 0000000..74d8043
--- /dev/null
+++ b/Tests/RunCMake/install/DIRECTORY-PATTERN.cmake
@@ -0,0 +1,36 @@
+install(
+ DIRECTORY pattern/
+ DESTINATION dir1
+ FILES_MATCHING
+ PATTERN "*.h"
+ REGEX "\\.c$"
+ )
+
+# FIXME: If/when CMake gains a good way to read file permissions, we should
+# check that these permissions were set correctly.
+install(
+ DIRECTORY pattern
+ DESTINATION dir2
+ FILE_PERMISSIONS OWNER_READ OWNER_WRITE
+ DIRECTORY_PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE
+ PATTERN "*.h" EXCLUDE
+ REGEX "\\.c$" EXCLUDE
+ )
+
+install(
+ DIRECTORY pattern/
+ DESTINATION dir3
+ PATTERN "*.h"
+ PERMISSIONS OWNER_READ OWNER_WRITE
+ )
+
+install(
+ DIRECTORY pattern/
+ DESTINATION dir4
+ USE_SOURCE_PERMISSIONS
+ )
+
+install(
+ DIRECTORY
+ DESTINATION empty
+ )
diff --git a/Tests/RunCMake/install/DIRECTORY-TYPE-Cache-all-check.cmake b/Tests/RunCMake/install/DIRECTORY-TYPE-Cache-all-check.cmake
new file mode 100644
index 0000000..fb393e3
--- /dev/null
+++ b/Tests/RunCMake/install/DIRECTORY-TYPE-Cache-all-check.cmake
@@ -0,0 +1,42 @@
+set(_check_files
+ [[mybin]]
+ [[mybin/dir]]
+ [[mybin/dir/empty\.txt]]
+ [[mycom]]
+ [[mycom/dir]]
+ [[mycom/dir/empty\.txt]]
+ [[mydoc]]
+ [[mydoc/dir]]
+ [[mydoc/dir/empty\.txt]]
+ [[myetc]]
+ [[myetc/dir]]
+ [[myetc/dir/empty\.txt]]
+ [[myinclude]]
+ [[myinclude/dir]]
+ [[myinclude/dir/empty\.txt]]
+ [[myinfo]]
+ [[myinfo/dir]]
+ [[myinfo/dir/empty\.txt]]
+ [[mylib]]
+ [[mylib/dir]]
+ [[mylib/dir/empty\.txt]]
+ [[mylocale]]
+ [[mylocale/dir]]
+ [[mylocale/dir/empty\.txt]]
+ [[myman]]
+ [[myman/dir]]
+ [[myman/dir/empty\.txt]]
+ [[myrun]]
+ [[myrun/dir]]
+ [[myrun/dir/empty\.txt]]
+ [[mysbin]]
+ [[mysbin/dir]]
+ [[mysbin/dir/empty\.txt]]
+ [[myshare]]
+ [[myshare/dir]]
+ [[myshare/dir/empty\.txt]]
+ [[myvar]]
+ [[myvar/dir]]
+ [[myvar/dir/empty\.txt]]
+ )
+check_installed("^${_check_files}$")
diff --git a/Tests/RunCMake/install/DIRECTORY-TYPE-Cache.cmake b/Tests/RunCMake/install/DIRECTORY-TYPE-Cache.cmake
new file mode 100644
index 0000000..53e95f8
--- /dev/null
+++ b/Tests/RunCMake/install/DIRECTORY-TYPE-Cache.cmake
@@ -0,0 +1,13 @@
+install(DIRECTORY dir TYPE BIN)
+install(DIRECTORY dir TYPE SBIN)
+install(DIRECTORY dir TYPE LIB)
+install(DIRECTORY dir TYPE INCLUDE)
+install(DIRECTORY dir TYPE SYSCONF)
+install(DIRECTORY dir TYPE SHAREDSTATE)
+install(DIRECTORY dir TYPE LOCALSTATE)
+install(DIRECTORY dir TYPE RUNSTATE)
+install(DIRECTORY dir TYPE DATA)
+install(DIRECTORY dir TYPE INFO)
+install(DIRECTORY dir TYPE LOCALE)
+install(DIRECTORY dir TYPE MAN)
+install(DIRECTORY dir TYPE DOC)
diff --git a/Tests/RunCMake/install/DIRECTORY-TYPE-CacheDependent-all-check.cmake b/Tests/RunCMake/install/DIRECTORY-TYPE-CacheDependent-all-check.cmake
new file mode 100644
index 0000000..03f7bd6
--- /dev/null
+++ b/Tests/RunCMake/install/DIRECTORY-TYPE-CacheDependent-all-check.cmake
@@ -0,0 +1,24 @@
+set(_check_files
+ [[myshare]]
+ [[myshare/dir]]
+ [[myshare/dir/empty\.txt]]
+ [[myshare/doc]]
+ [[myshare/doc/dir]]
+ [[myshare/doc/dir/empty\.txt]]
+ [[myshare/info]]
+ [[myshare/info/dir]]
+ [[myshare/info/dir/empty\.txt]]
+ [[myshare/locale]]
+ [[myshare/locale/dir]]
+ [[myshare/locale/dir/empty\.txt]]
+ [[myshare/man]]
+ [[myshare/man/dir]]
+ [[myshare/man/dir/empty.txt]]
+ [[myvar]]
+ [[myvar/dir]]
+ [[myvar/dir/empty\.txt]]
+ [[myvar/run]]
+ [[myvar/run/dir]]
+ [[myvar/run/dir/empty\.txt]]
+ )
+check_installed("^${_check_files}$")
diff --git a/Tests/RunCMake/install/DIRECTORY-TYPE-CacheDependent.cmake b/Tests/RunCMake/install/DIRECTORY-TYPE-CacheDependent.cmake
new file mode 100644
index 0000000..e797abb
--- /dev/null
+++ b/Tests/RunCMake/install/DIRECTORY-TYPE-CacheDependent.cmake
@@ -0,0 +1,7 @@
+install(DIRECTORY dir TYPE LOCALSTATE)
+install(DIRECTORY dir TYPE RUNSTATE)
+install(DIRECTORY dir TYPE DATA)
+install(DIRECTORY dir TYPE INFO)
+install(DIRECTORY dir TYPE LOCALE)
+install(DIRECTORY dir TYPE MAN)
+install(DIRECTORY dir TYPE DOC)
diff --git a/Tests/RunCMake/install/DIRECTORY-TYPE-all-check.cmake b/Tests/RunCMake/install/DIRECTORY-TYPE-all-check.cmake
new file mode 100644
index 0000000..03fa3c8
--- /dev/null
+++ b/Tests/RunCMake/install/DIRECTORY-TYPE-all-check.cmake
@@ -0,0 +1,42 @@
+set(_check_files
+ [[bin]]
+ [[bin/dir]]
+ [[bin/dir/empty\.txt]]
+ [[com]]
+ [[com/dir]]
+ [[com/dir/empty\.txt]]
+ [[etc]]
+ [[etc/dir]]
+ [[etc/dir/empty\.txt]]
+ [[include]]
+ [[include/dir]]
+ [[include/dir/empty\.txt]]
+ [[lib]]
+ [[lib/dir]]
+ [[lib/dir/empty\.txt]]
+ [[sbin]]
+ [[sbin/dir]]
+ [[sbin/dir/empty\.txt]]
+ [[share]]
+ [[share/dir]]
+ [[share/dir/empty\.txt]]
+ [[share/doc]]
+ [[share/doc/dir]]
+ [[share/doc/dir/empty\.txt]]
+ [[share/info]]
+ [[share/info/dir]]
+ [[share/info/dir/empty\.txt]]
+ [[share/locale]]
+ [[share/locale/dir]]
+ [[share/locale/dir/empty\.txt]]
+ [[share/man]]
+ [[share/man/dir]]
+ [[share/man/dir/empty\.txt]]
+ [[var]]
+ [[var/dir]]
+ [[var/dir/empty\.txt]]
+ [[var/run]]
+ [[var/run/dir]]
+ [[var/run/dir/empty\.txt]]
+ )
+check_installed("^${_check_files}$")
diff --git a/Tests/RunCMake/install/DIRECTORY-TYPE.cmake b/Tests/RunCMake/install/DIRECTORY-TYPE.cmake
new file mode 100644
index 0000000..53e95f8
--- /dev/null
+++ b/Tests/RunCMake/install/DIRECTORY-TYPE.cmake
@@ -0,0 +1,13 @@
+install(DIRECTORY dir TYPE BIN)
+install(DIRECTORY dir TYPE SBIN)
+install(DIRECTORY dir TYPE LIB)
+install(DIRECTORY dir TYPE INCLUDE)
+install(DIRECTORY dir TYPE SYSCONF)
+install(DIRECTORY dir TYPE SHAREDSTATE)
+install(DIRECTORY dir TYPE LOCALSTATE)
+install(DIRECTORY dir TYPE RUNSTATE)
+install(DIRECTORY dir TYPE DATA)
+install(DIRECTORY dir TYPE INFO)
+install(DIRECTORY dir TYPE LOCALE)
+install(DIRECTORY dir TYPE MAN)
+install(DIRECTORY dir TYPE DOC)
diff --git a/Tests/RunCMake/install/DIRECTORY-message-check.cmake b/Tests/RunCMake/install/DIRECTORY-message-check.cmake
new file mode 100644
index 0000000..c9de3ea
--- /dev/null
+++ b/Tests/RunCMake/install/DIRECTORY-message-check.cmake
@@ -0,0 +1,28 @@
+file(REMOVE_RECURSE ${RunCMake_TEST_BINARY_DIR}/prefix)
+execute_process(COMMAND ${CMAKE_COMMAND} -P ${RunCMake_TEST_BINARY_DIR}/cmake_install.cmake
+ OUTPUT_VARIABLE out ERROR_VARIABLE err)
+set(expect "
+-- Installing: [^\n]*/prefix/dir\r?
+-- Installing: [^\n]*/prefix/dir/empty.txt\r?
+")
+if(NOT out MATCHES "${expect}")
+ string(REGEX REPLACE "\n" "\n " out " ${out}")
+ string(APPEND RunCMake_TEST_FAILED
+ "First install did not say 'Installing' as expected:\n${out}")
+endif()
+set(f ${RunCMake_TEST_BINARY_DIR}/prefix/dir/empty.txt)
+if(NOT EXISTS "${f}")
+ string(APPEND RunCMake_TEST_FAILED
+ "File was not installed:\n ${f}\n")
+endif()
+execute_process(COMMAND ${CMAKE_COMMAND} -P ${RunCMake_TEST_BINARY_DIR}/cmake_install.cmake
+ OUTPUT_VARIABLE out ERROR_VARIABLE err)
+set(expect "
+-- Up-to-date: [^\n]*/prefix/dir\r?
+-- Up-to-date: [^\n]*/prefix/dir/empty.txt\r?
+")
+if(NOT out MATCHES "${expect}")
+ string(REGEX REPLACE "\n" "\n " out " ${out}")
+ string(APPEND RunCMake_TEST_FAILED
+ "Second install did not say 'Up-to-date' as expected:\n${out}")
+endif()
diff --git a/Tests/RunCMake/install/DIRECTORY-message-lazy-check.cmake b/Tests/RunCMake/install/DIRECTORY-message-lazy-check.cmake
new file mode 100644
index 0000000..4339012
--- /dev/null
+++ b/Tests/RunCMake/install/DIRECTORY-message-lazy-check.cmake
@@ -0,0 +1,24 @@
+file(REMOVE_RECURSE ${RunCMake_TEST_BINARY_DIR}/prefix)
+execute_process(COMMAND ${CMAKE_COMMAND} -P ${RunCMake_TEST_BINARY_DIR}/cmake_install.cmake
+ OUTPUT_VARIABLE out ERROR_VARIABLE err)
+set(expect "
+-- Installing: [^\n]*/prefix/dir\r?
+-- Installing: [^\n]*/prefix/dir/empty.txt\r?
+")
+if(NOT out MATCHES "${expect}")
+ string(REGEX REPLACE "\n" "\n " out " ${out}")
+ string(APPEND RunCMake_TEST_FAILED
+ "First install did not say 'Installing' as expected:\n${out}")
+endif()
+set(f ${RunCMake_TEST_BINARY_DIR}/prefix/dir/empty.txt)
+if(NOT EXISTS "${f}")
+ string(APPEND RunCMake_TEST_FAILED
+ "File was not installed:\n ${f}\n")
+endif()
+execute_process(COMMAND ${CMAKE_COMMAND} -P ${RunCMake_TEST_BINARY_DIR}/cmake_install.cmake
+ OUTPUT_VARIABLE out ERROR_VARIABLE err)
+if(out MATCHES "(Installing|Up-to-date)")
+ string(REGEX REPLACE "\n" "\n " out " ${out}")
+ string(APPEND RunCMake_TEST_FAILED
+ "Second install was not silent as expected:\n${out}")
+endif()
diff --git a/Tests/RunCMake/install/DIRECTORY-message-lazy.cmake b/Tests/RunCMake/install/DIRECTORY-message-lazy.cmake
new file mode 100644
index 0000000..ed43567
--- /dev/null
+++ b/Tests/RunCMake/install/DIRECTORY-message-lazy.cmake
@@ -0,0 +1,3 @@
+set(CMAKE_INSTALL_MESSAGE "LAZY")
+set(CMAKE_INSTALL_PREFIX "${CMAKE_BINARY_DIR}/prefix")
+install(DIRECTORY dir/ DESTINATION dir)
diff --git a/Tests/RunCMake/install/DIRECTORY-message.cmake b/Tests/RunCMake/install/DIRECTORY-message.cmake
new file mode 100644
index 0000000..913ed15
--- /dev/null
+++ b/Tests/RunCMake/install/DIRECTORY-message.cmake
@@ -0,0 +1,3 @@
+set(CMAKE_INSTALL_MESSAGE "ALWAYS")
+set(CMAKE_INSTALL_PREFIX "${CMAKE_BINARY_DIR}/prefix")
+install(DIRECTORY dir/ DESTINATION dir)
diff --git a/Tests/RunCMake/install/Deprecated-all-check.cmake b/Tests/RunCMake/install/Deprecated-all-check.cmake
new file mode 100644
index 0000000..9ea33a6
--- /dev/null
+++ b/Tests/RunCMake/install/Deprecated-all-check.cmake
@@ -0,0 +1 @@
+check_installed([[^bin;bin/myexe(\.exe)?;scripts1;scripts1/script;scripts1/script\.bat;scripts2;scripts2/script;scripts2/script\.bat;scripts3;scripts3/script;scripts3/script\.bat;src;src/empty\.c;src/obj1\.c;src/obj\2.c$]])
diff --git a/Tests/RunCMake/install/Deprecated.cmake b/Tests/RunCMake/install/Deprecated.cmake
new file mode 100644
index 0000000..c435cb5
--- /dev/null
+++ b/Tests/RunCMake/install/Deprecated.cmake
@@ -0,0 +1,13 @@
+enable_language(C)
+
+add_executable(myexe main.c)
+
+install_files(/src FILES empty.c)
+install_files(/src .c obj1)
+install_files(/src "^obj2.c$")
+
+install_targets(/bin myexe)
+
+install_programs(/scripts1 FILES script script.bat)
+install_programs(/scripts2 script script.bat)
+install_programs(/scripts3 "^script(\.bat)?$")
diff --git a/Tests/RunCMake/install/EXPORT-OldIFace.cmake b/Tests/RunCMake/install/EXPORT-OldIFace.cmake
new file mode 100644
index 0000000..ee3fb23
--- /dev/null
+++ b/Tests/RunCMake/install/EXPORT-OldIFace.cmake
@@ -0,0 +1,8 @@
+enable_language(C)
+set(CMAKE_BUILD_WITH_INSTALL_RPATH 1)
+set(CMAKE_BUILD_WITH_INSTALL_NAME_DIR 1)
+add_subdirectory(EXPORT-OldIFace)
+add_library(foo SHARED empty.c)
+target_link_libraries(foo bar)
+install(TARGETS foo DESTINATION lib EXPORT fooExport)
+install(EXPORT fooExport DESTINATION lib/cmake/foo EXPORT_LINK_INTERFACE_LIBRARIES)
diff --git a/Tests/RunCMake/install/EXPORT-OldIFace/CMakeLists.txt b/Tests/RunCMake/install/EXPORT-OldIFace/CMakeLists.txt
new file mode 100644
index 0000000..32292e2
--- /dev/null
+++ b/Tests/RunCMake/install/EXPORT-OldIFace/CMakeLists.txt
@@ -0,0 +1,2 @@
+add_library(bar SHARED ../empty.c)
+install(TARGETS bar DESTINATION lib EXPORT fooExport)
diff --git a/Tests/RunCMake/install/FILES-DESTINATION-TYPE-result.txt b/Tests/RunCMake/install/FILES-DESTINATION-TYPE-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/install/FILES-DESTINATION-TYPE-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/install/FILES-DESTINATION-TYPE-stderr.txt b/Tests/RunCMake/install/FILES-DESTINATION-TYPE-stderr.txt
new file mode 100644
index 0000000..ce8fc23
--- /dev/null
+++ b/Tests/RunCMake/install/FILES-DESTINATION-TYPE-stderr.txt
@@ -0,0 +1,5 @@
+^CMake Error at FILES-DESTINATION-TYPE\.cmake:[0-9]+ \(install\):
+ install FILES given both TYPE and DESTINATION arguments\. You may only
+ specify one\.
+Call Stack \(most recent call first\):
+ CMakeLists\.txt:[0-9]+ \(include\)$
diff --git a/Tests/RunCMake/install/FILES-DESTINATION-TYPE.cmake b/Tests/RunCMake/install/FILES-DESTINATION-TYPE.cmake
new file mode 100644
index 0000000..576c98f
--- /dev/null
+++ b/Tests/RunCMake/install/FILES-DESTINATION-TYPE.cmake
@@ -0,0 +1 @@
+install(FILES main.c TYPE BIN DESTINATION mybin)
diff --git a/Tests/RunCMake/install/FILES-DESTINATION-bad-result.txt b/Tests/RunCMake/install/FILES-DESTINATION-bad-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/install/FILES-DESTINATION-bad-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/install/FILES-DESTINATION-bad-stderr.txt b/Tests/RunCMake/install/FILES-DESTINATION-bad-stderr.txt
new file mode 100644
index 0000000..9844158
--- /dev/null
+++ b/Tests/RunCMake/install/FILES-DESTINATION-bad-stderr.txt
@@ -0,0 +1,6 @@
+CMake Error:
+ Error evaluating generator expression:
+
+ \$<NOTAGENEX>
+
+ Expression did not evaluate to a known generator expression
diff --git a/Tests/RunCMake/install/FILES-DESTINATION-bad.cmake b/Tests/RunCMake/install/FILES-DESTINATION-bad.cmake
new file mode 100644
index 0000000..0fda078
--- /dev/null
+++ b/Tests/RunCMake/install/FILES-DESTINATION-bad.cmake
@@ -0,0 +1 @@
+install(FILES empty.c DESTINATION $<NOTAGENEX>)
diff --git a/Tests/RunCMake/install/FILES-EXCLUDE_FROM_ALL-all-check.cmake b/Tests/RunCMake/install/FILES-EXCLUDE_FROM_ALL-all-check.cmake
new file mode 100644
index 0000000..0368df1
--- /dev/null
+++ b/Tests/RunCMake/install/FILES-EXCLUDE_FROM_ALL-all-check.cmake
@@ -0,0 +1 @@
+check_installed([[^src-all;src-all/main\.c$]])
diff --git a/Tests/RunCMake/install/FILES-EXCLUDE_FROM_ALL-exc-check.cmake b/Tests/RunCMake/install/FILES-EXCLUDE_FROM_ALL-exc-check.cmake
new file mode 100644
index 0000000..41a816f
--- /dev/null
+++ b/Tests/RunCMake/install/FILES-EXCLUDE_FROM_ALL-exc-check.cmake
@@ -0,0 +1 @@
+check_installed([[^src-exc;src-exc/main\.c$]])
diff --git a/Tests/RunCMake/install/FILES-EXCLUDE_FROM_ALL-uns-check.cmake b/Tests/RunCMake/install/FILES-EXCLUDE_FROM_ALL-uns-check.cmake
new file mode 100644
index 0000000..68a1378
--- /dev/null
+++ b/Tests/RunCMake/install/FILES-EXCLUDE_FROM_ALL-uns-check.cmake
@@ -0,0 +1 @@
+check_installed([[^src-all;src-all/main\.c;src-uns;src-uns/main\.c$]])
diff --git a/Tests/RunCMake/install/FILES-EXCLUDE_FROM_ALL.cmake b/Tests/RunCMake/install/FILES-EXCLUDE_FROM_ALL.cmake
new file mode 100644
index 0000000..720299b
--- /dev/null
+++ b/Tests/RunCMake/install/FILES-EXCLUDE_FROM_ALL.cmake
@@ -0,0 +1,3 @@
+install(FILES main.c DESTINATION src-all)
+install(FILES main.c DESTINATION src-uns EXCLUDE_FROM_ALL)
+install(FILES main.c DESTINATION src-exc EXCLUDE_FROM_ALL COMPONENT exc)
diff --git a/Tests/RunCMake/install/FILES-OPTIONAL-all-check.cmake b/Tests/RunCMake/install/FILES-OPTIONAL-all-check.cmake
new file mode 100644
index 0000000..2997a8d
--- /dev/null
+++ b/Tests/RunCMake/install/FILES-OPTIONAL-all-check.cmake
@@ -0,0 +1 @@
+check_installed([[^src;src/main.c$]])
diff --git a/Tests/RunCMake/install/FILES-OPTIONAL.cmake b/Tests/RunCMake/install/FILES-OPTIONAL.cmake
new file mode 100644
index 0000000..812bf4f
--- /dev/null
+++ b/Tests/RunCMake/install/FILES-OPTIONAL.cmake
@@ -0,0 +1 @@
+install(FILES main.c noexist.c DESTINATION src OPTIONAL)
diff --git a/Tests/RunCMake/install/FILES-PERMISSIONS-all-check.cmake b/Tests/RunCMake/install/FILES-PERMISSIONS-all-check.cmake
new file mode 100644
index 0000000..b8ba6d0
--- /dev/null
+++ b/Tests/RunCMake/install/FILES-PERMISSIONS-all-check.cmake
@@ -0,0 +1 @@
+check_installed([[^src;src/empty.c]])
diff --git a/Tests/RunCMake/install/FILES-PERMISSIONS.cmake b/Tests/RunCMake/install/FILES-PERMISSIONS.cmake
new file mode 100644
index 0000000..999c271
--- /dev/null
+++ b/Tests/RunCMake/install/FILES-PERMISSIONS.cmake
@@ -0,0 +1,5 @@
+install(
+ FILES empty.c
+ DESTINATION src
+ PERMISSIONS OWNER_READ OWNER_WRITE
+ )
diff --git a/Tests/RunCMake/install/FILES-TARGET_OBJECTS-all-check.cmake b/Tests/RunCMake/install/FILES-TARGET_OBJECTS-all-check.cmake
new file mode 100644
index 0000000..f7f2a3a
--- /dev/null
+++ b/Tests/RunCMake/install/FILES-TARGET_OBJECTS-all-check.cmake
@@ -0,0 +1 @@
+check_installed([[^objs;objs/obj1(\.c)?\.(o|obj);objs/obj2(\.c)?\.(o|obj)$]])
diff --git a/Tests/RunCMake/install/FILES-TARGET_OBJECTS.cmake b/Tests/RunCMake/install/FILES-TARGET_OBJECTS.cmake
new file mode 100644
index 0000000..40c58ad
--- /dev/null
+++ b/Tests/RunCMake/install/FILES-TARGET_OBJECTS.cmake
@@ -0,0 +1,3 @@
+enable_language(C)
+add_library(objs OBJECT obj1.c obj2.c)
+install(FILES $<TARGET_OBJECTS:objs> DESTINATION objs)
diff --git a/Tests/RunCMake/install/FILES-TYPE-Cache-all-check.cmake b/Tests/RunCMake/install/FILES-TYPE-Cache-all-check.cmake
new file mode 100644
index 0000000..dfb90cf
--- /dev/null
+++ b/Tests/RunCMake/install/FILES-TYPE-Cache-all-check.cmake
@@ -0,0 +1,29 @@
+set(_check_files
+ [[mybin]]
+ [[mybin/main\.c]]
+ [[mycom]]
+ [[mycom/main\.c]]
+ [[mydoc]]
+ [[mydoc/main\.c]]
+ [[myetc]]
+ [[myetc/main\.c]]
+ [[myinclude]]
+ [[myinclude/main\.c]]
+ [[myinfo]]
+ [[myinfo/main\.c]]
+ [[mylib]]
+ [[mylib/main\.c]]
+ [[mylocale]]
+ [[mylocale/main\.c]]
+ [[myman]]
+ [[myman/main\.c]]
+ [[myrun]]
+ [[myrun/main\.c]]
+ [[mysbin]]
+ [[mysbin/main\.c]]
+ [[myshare]]
+ [[myshare/main\.c]]
+ [[myvar]]
+ [[myvar/main\.c]]
+ )
+check_installed("^${_check_files}$")
diff --git a/Tests/RunCMake/install/FILES-TYPE-Cache.cmake b/Tests/RunCMake/install/FILES-TYPE-Cache.cmake
new file mode 100644
index 0000000..2e2bfc7
--- /dev/null
+++ b/Tests/RunCMake/install/FILES-TYPE-Cache.cmake
@@ -0,0 +1,13 @@
+install(FILES main.c TYPE BIN)
+install(FILES main.c TYPE SBIN)
+install(FILES main.c TYPE LIB)
+install(FILES main.c TYPE INCLUDE)
+install(FILES main.c TYPE SYSCONF)
+install(FILES main.c TYPE SHAREDSTATE)
+install(FILES main.c TYPE LOCALSTATE)
+install(FILES main.c TYPE RUNSTATE)
+install(FILES main.c TYPE DATA)
+install(FILES main.c TYPE INFO)
+install(FILES main.c TYPE LOCALE)
+install(FILES main.c TYPE MAN)
+install(FILES main.c TYPE DOC)
diff --git a/Tests/RunCMake/install/FILES-TYPE-CacheDependent-all-check.cmake b/Tests/RunCMake/install/FILES-TYPE-CacheDependent-all-check.cmake
new file mode 100644
index 0000000..e58c80a
--- /dev/null
+++ b/Tests/RunCMake/install/FILES-TYPE-CacheDependent-all-check.cmake
@@ -0,0 +1,17 @@
+set(_check_files
+ [[myshare]]
+ [[myshare/doc]]
+ [[myshare/doc/main\.c]]
+ [[myshare/info]]
+ [[myshare/info/main\.c]]
+ [[myshare/locale]]
+ [[myshare/locale/main\.c]]
+ [[myshare/main\.c]]
+ [[myshare/man]]
+ [[myshare/man/main\.c]]
+ [[myvar]]
+ [[myvar/main\.c]]
+ [[myvar/run]]
+ [[myvar/run/main\.c]]
+ )
+check_installed("^${_check_files}$")
diff --git a/Tests/RunCMake/install/FILES-TYPE-CacheDependent.cmake b/Tests/RunCMake/install/FILES-TYPE-CacheDependent.cmake
new file mode 100644
index 0000000..d7d5aaa
--- /dev/null
+++ b/Tests/RunCMake/install/FILES-TYPE-CacheDependent.cmake
@@ -0,0 +1,7 @@
+install(FILES main.c TYPE LOCALSTATE)
+install(FILES main.c TYPE RUNSTATE)
+install(FILES main.c TYPE DATA)
+install(FILES main.c TYPE INFO)
+install(FILES main.c TYPE LOCALE)
+install(FILES main.c TYPE MAN)
+install(FILES main.c TYPE DOC)
diff --git a/Tests/RunCMake/install/FILES-TYPE-all-check.cmake b/Tests/RunCMake/install/FILES-TYPE-all-check.cmake
new file mode 100644
index 0000000..c4ec661
--- /dev/null
+++ b/Tests/RunCMake/install/FILES-TYPE-all-check.cmake
@@ -0,0 +1,29 @@
+set(_check_files
+ [[bin]]
+ [[bin/main\.c]]
+ [[com]]
+ [[com/main\.c]]
+ [[etc]]
+ [[etc/main\.c]]
+ [[include]]
+ [[include/main\.c]]
+ [[lib]]
+ [[lib/main\.c]]
+ [[sbin]]
+ [[sbin/main\.c]]
+ [[share]]
+ [[share/doc]]
+ [[share/doc/main\.c]]
+ [[share/info]]
+ [[share/info/main\.c]]
+ [[share/locale]]
+ [[share/locale/main\.c]]
+ [[share/main\.c]]
+ [[share/man]]
+ [[share/man/main\.c]]
+ [[var]]
+ [[var/main\.c]]
+ [[var/run]]
+ [[var/run/main\.c]]
+ )
+check_installed("^${_check_files}$")
diff --git a/Tests/RunCMake/install/FILES-TYPE.cmake b/Tests/RunCMake/install/FILES-TYPE.cmake
new file mode 100644
index 0000000..2e2bfc7
--- /dev/null
+++ b/Tests/RunCMake/install/FILES-TYPE.cmake
@@ -0,0 +1,13 @@
+install(FILES main.c TYPE BIN)
+install(FILES main.c TYPE SBIN)
+install(FILES main.c TYPE LIB)
+install(FILES main.c TYPE INCLUDE)
+install(FILES main.c TYPE SYSCONF)
+install(FILES main.c TYPE SHAREDSTATE)
+install(FILES main.c TYPE LOCALSTATE)
+install(FILES main.c TYPE RUNSTATE)
+install(FILES main.c TYPE DATA)
+install(FILES main.c TYPE INFO)
+install(FILES main.c TYPE LOCALE)
+install(FILES main.c TYPE MAN)
+install(FILES main.c TYPE DOC)
diff --git a/Tests/RunCMake/install/InstallRequiredSystemLibraries-stderr.txt b/Tests/RunCMake/install/InstallRequiredSystemLibraries-stderr.txt
new file mode 100644
index 0000000..8d98f9d
--- /dev/null
+++ b/Tests/RunCMake/install/InstallRequiredSystemLibraries-stderr.txt
@@ -0,0 +1 @@
+.*
diff --git a/Tests/RunCMake/install/InstallRequiredSystemLibraries.cmake b/Tests/RunCMake/install/InstallRequiredSystemLibraries.cmake
new file mode 100644
index 0000000..27ff683
--- /dev/null
+++ b/Tests/RunCMake/install/InstallRequiredSystemLibraries.cmake
@@ -0,0 +1,10 @@
+enable_language(C)
+set(CMAKE_INSTALL_MFC_LIBRARIES 1)
+set(CMAKE_INSTALL_DEBUG_LIBRARIES 1)
+set(CMAKE_INSTALL_UCRT_LIBRARIES 1)
+set(CMAKE_INSTALL_OPENMP_LIBRARIES 1)
+include(InstallRequiredSystemLibraries)
+
+# FIXME: This test emits warnings because InstallRequiredSystemLibraries
+# doesn't currently work properly. The warnings have been suppressed in
+# InstallRequiredSystemLibraries-stderr.txt. This needs to be fixed.
diff --git a/Tests/RunCMake/install/PRE_POST_INSTALL_SCRIPT-all-check.cmake b/Tests/RunCMake/install/PRE_POST_INSTALL_SCRIPT-all-check.cmake
new file mode 100644
index 0000000..16ff1e1
--- /dev/null
+++ b/Tests/RunCMake/install/PRE_POST_INSTALL_SCRIPT-all-check.cmake
@@ -0,0 +1 @@
+check_installed([[^bin;bin/myexe(\.exe)?;postinstall;preinstall]])
diff --git a/Tests/RunCMake/install/PRE_POST_INSTALL_SCRIPT.cmake b/Tests/RunCMake/install/PRE_POST_INSTALL_SCRIPT.cmake
new file mode 100644
index 0000000..357c688
--- /dev/null
+++ b/Tests/RunCMake/install/PRE_POST_INSTALL_SCRIPT.cmake
@@ -0,0 +1,7 @@
+enable_language(C)
+
+add_executable(myexe main.c)
+set_property(TARGET myexe PROPERTY PRE_INSTALL_SCRIPT "${CMAKE_CURRENT_SOURCE_DIR}/preinstall.cmake")
+set_property(TARGET myexe PROPERTY POST_INSTALL_SCRIPT "${CMAKE_CURRENT_SOURCE_DIR}/postinstall.cmake")
+
+install(TARGETS myexe DESTINATION bin)
diff --git a/Tests/RunCMake/install/RunCMakeTest.cmake b/Tests/RunCMake/install/RunCMakeTest.cmake
new file mode 100644
index 0000000..70570b7
--- /dev/null
+++ b/Tests/RunCMake/install/RunCMakeTest.cmake
@@ -0,0 +1,194 @@
+cmake_minimum_required(VERSION 3.4)
+include(RunCMake)
+
+# Function to build and install a project. The latter step *-check.cmake
+# scripts can check installed files using the check_installed function.
+function(run_install_test case)
+ set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/${case}-build)
+ set(RunCMake_TEST_NO_CLEAN 1)
+ file(REMOVE_RECURSE "${RunCMake_TEST_BINARY_DIR}")
+ file(MAKE_DIRECTORY "${RunCMake_TEST_BINARY_DIR}")
+ run_cmake(${case})
+ run_cmake_command(${case}-build ${CMAKE_COMMAND} --build . --config Debug)
+ # Check "all" components.
+ set(CMAKE_INSTALL_PREFIX ${RunCMake_TEST_BINARY_DIR}/root-all)
+ run_cmake_command(${case}-all ${CMAKE_COMMAND} -DCMAKE_INSTALL_PREFIX=${CMAKE_INSTALL_PREFIX} -DBUILD_TYPE=Debug -P cmake_install.cmake)
+
+ if(run_install_test_components)
+ # Check unspecified component.
+ set(CMAKE_INSTALL_PREFIX ${RunCMake_TEST_BINARY_DIR}/root-uns)
+ run_cmake_command(${case}-uns ${CMAKE_COMMAND} -DCMAKE_INSTALL_PREFIX=${CMAKE_INSTALL_PREFIX} -DBUILD_TYPE=Debug -DCOMPONENT=Unspecified -P cmake_install.cmake)
+ # Check explicit component.
+ set(CMAKE_INSTALL_PREFIX ${RunCMake_TEST_BINARY_DIR}/root-exc)
+ run_cmake_command(${case}-exc ${CMAKE_COMMAND} -DCMAKE_INSTALL_PREFIX=${CMAKE_INSTALL_PREFIX} -DBUILD_TYPE=Debug -DCOMPONENT=exc -P cmake_install.cmake)
+ set(CMAKE_INSTALL_PREFIX ${RunCMake_TEST_BINARY_DIR}/root-lib)
+ run_cmake_command(${case}-lib ${CMAKE_COMMAND} -DCMAKE_INSTALL_PREFIX=${CMAKE_INSTALL_PREFIX} -DBUILD_TYPE=Debug -DCOMPONENT=lib -P cmake_install.cmake)
+ set(CMAKE_INSTALL_PREFIX ${RunCMake_TEST_BINARY_DIR}/root-dev)
+ run_cmake_command(${case}-dev ${CMAKE_COMMAND} -DCMAKE_INSTALL_PREFIX=${CMAKE_INSTALL_PREFIX} -DBUILD_TYPE=Debug -DCOMPONENT=dev -P cmake_install.cmake)
+ endif()
+endfunction()
+
+# Function called in *-check.cmake scripts to check installed files.
+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}")
+ set(RunCMake_TEST_FAILED "Installed files:
+ ${actual}
+do not match what we expected:
+ ${expect}
+in directory:
+ ${CMAKE_INSTALL_PREFIX}" PARENT_SCOPE)
+ endif()
+endfunction()
+
+# Wrapper for run_cmake() that skips platforms that are non-ELF or have no RPATH support
+function(run_cmake_ELFRPATH_only case)
+ if(UNIX AND CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG AND CMAKE_EXECUTABLE_FORMAT STREQUAL "ELF")
+ run_cmake(${case})
+ else()
+ # Sanity check against a platform known to be ELF-based
+ if(CMAKE_SYSTEM_NAME STREQUAL "Linux")
+ message(FATAL_ERROR "Expected platform Linux to advertize itself as ELF-based, but it did not.")
+ else()
+ message(STATUS "${case} - SKIPPED (No ELF-based platform found)")
+ endif()
+ endif()
+endfunction()
+
+run_cmake(TARGETS-FILE_RPATH_CHANGE-old_rpath)
+run_cmake_ELFRPATH_only(TARGETS-FILE_RPATH_CHANGE-new_rpath)
+run_cmake(DIRECTORY-MESSAGE_NEVER)
+run_cmake(DIRECTORY-PATTERN-MESSAGE_NEVER)
+run_cmake(DIRECTORY-message)
+run_cmake(DIRECTORY-message-lazy)
+run_cmake(SkipInstallRulesWarning)
+run_cmake(SkipInstallRulesNoWarning1)
+run_cmake(SkipInstallRulesNoWarning2)
+run_cmake(DIRECTORY-DIRECTORY-bad)
+run_cmake(DIRECTORY-DESTINATION-bad)
+run_cmake(FILES-DESTINATION-bad)
+run_cmake(TARGETS-DESTINATION-bad)
+run_cmake(EXPORT-OldIFace)
+run_cmake(CMP0062-OLD)
+run_cmake(CMP0062-NEW)
+run_cmake(CMP0062-WARN)
+run_cmake(CMP0087-OLD)
+run_cmake(CMP0087-NEW)
+run_cmake(CMP0087-WARN)
+run_cmake(TARGETS-ImportedGlobal)
+run_cmake(TARGETS-NAMELINK_COMPONENT-bad-all)
+run_cmake(TARGETS-NAMELINK_COMPONENT-bad-exc)
+run_cmake(FILES-DESTINATION-TYPE)
+run_cmake(DIRECTORY-DESTINATION-TYPE)
+
+if(APPLE)
+ run_cmake(TARGETS-Apple-Defaults)
+endif()
+
+if(NOT RunCMake_GENERATOR STREQUAL "Xcode" OR NOT "$ENV{CMAKE_OSX_ARCHITECTURES}" MATCHES "[;$]")
+ run_install_test(FILES-TARGET_OBJECTS)
+endif()
+
+run_install_test(TARGETS-InstallFromSubDir)
+run_install_test(TARGETS-OPTIONAL)
+run_install_test(FILES-OPTIONAL)
+run_install_test(DIRECTORY-OPTIONAL)
+run_install_test(TARGETS-Defaults)
+
+set(RunCMake_TEST_OPTIONS
+ "-DCMAKE_INSTALL_BINDIR:PATH=mybin"
+ "-DCMAKE_INSTALL_LIBDIR:PATH=mylib"
+ "-DCMAKE_INSTALL_INCLUDEDIR:PATH=myinclude"
+ )
+run_install_test(TARGETS-Defaults-Cache)
+unset(RunCMake_TEST_OPTIONS)
+
+run_install_test(FILES-TYPE)
+run_install_test(DIRECTORY-TYPE)
+
+set(RunCMake_TEST_OPTIONS
+ "-DCMAKE_INSTALL_BINDIR:PATH=mybin"
+ "-DCMAKE_INSTALL_SBINDIR:PATH=mysbin"
+ "-DCMAKE_INSTALL_LIBEXECDIR:PATH=mylibexec"
+ "-DCMAKE_INSTALL_LIBDIR:PATH=mylib"
+ "-DCMAKE_INSTALL_INCLUDEDIR:PATH=myinclude"
+ "-DCMAKE_INSTALL_SYSCONFDIR:PATH=myetc"
+ "-DCMAKE_INSTALL_SHAREDSTATEDIR:PATH=mycom"
+ "-DCMAKE_INSTALL_LOCALSTATEDIR:PATH=myvar"
+ "-DCMAKE_INSTALL_RUNSTATEDIR:PATH=myrun"
+ "-DCMAKE_INSTALL_DATADIR:PATH=myshare"
+ "-DCMAKE_INSTALL_INFODIR:PATH=myinfo"
+ "-DCMAKE_INSTALL_LOCALEDIR:PATH=mylocale"
+ "-DCMAKE_INSTALL_MANDIR:PATH=myman"
+ "-DCMAKE_INSTALL_DOCDIR:PATH=mydoc"
+ )
+run_install_test(FILES-TYPE-Cache)
+run_install_test(DIRECTORY-TYPE-Cache)
+unset(RunCMake_TEST_OPTIONS)
+
+set(RunCMake_TEST_OPTIONS
+ "-DCMAKE_INSTALL_LOCALSTATEDIR:PATH=myvar"
+ "-DCMAKE_INSTALL_DATAROOTDIR:PATH=myshare"
+ )
+run_install_test(FILES-TYPE-CacheDependent)
+run_install_test(DIRECTORY-TYPE-CacheDependent)
+unset(RunCMake_TEST_OPTIONS)
+
+set(RunCMake_TEST_OPTIONS "-DCMAKE_BUILD_TYPE:STRING=Debug")
+run_install_test(TARGETS-OUTPUT_NAME)
+unset(RunCMake_TEST_OPTIONS)
+
+run_install_test(Deprecated)
+run_install_test(PRE_POST_INSTALL_SCRIPT)
+run_install_test(SCRIPT)
+run_install_test(TARGETS-CONFIGURATIONS)
+run_install_test(DIRECTORY-PATTERN)
+run_install_test(TARGETS-Parts)
+run_install_test(FILES-PERMISSIONS)
+run_install_test(TARGETS-RPATH)
+run_install_test(InstallRequiredSystemLibraries)
+
+if(CMAKE_HOST_SYSTEM_NAME STREQUAL "Darwin")
+ if(NOT CMake_INSTALL_NAME_TOOL_BUG)
+ run_install_test(file-GET_RUNTIME_DEPENDENCIES-macos)
+ run_install_test(file-GET_RUNTIME_DEPENDENCIES-macos-unresolved)
+ run_install_test(file-GET_RUNTIME_DEPENDENCIES-macos-conflict)
+ run_install_test(file-GET_RUNTIME_DEPENDENCIES-macos-notfile)
+ endif()
+ run_cmake(file-GET_RUNTIME_DEPENDENCIES-project)
+ run_cmake(file-GET_RUNTIME_DEPENDENCIES-badargs1)
+ run_cmake(file-GET_RUNTIME_DEPENDENCIES-badargs2)
+elseif(CMAKE_HOST_SYSTEM_NAME STREQUAL "Windows")
+ run_install_test(file-GET_RUNTIME_DEPENDENCIES-windows)
+ run_install_test(file-GET_RUNTIME_DEPENDENCIES-windows-unresolved)
+ run_install_test(file-GET_RUNTIME_DEPENDENCIES-windows-conflict)
+ run_install_test(file-GET_RUNTIME_DEPENDENCIES-windows-notfile)
+ run_cmake(file-GET_RUNTIME_DEPENDENCIES-project)
+ run_cmake(file-GET_RUNTIME_DEPENDENCIES-badargs1)
+ run_cmake(file-GET_RUNTIME_DEPENDENCIES-badargs2)
+elseif(CMAKE_HOST_SYSTEM_NAME STREQUAL "Linux")
+ if(NOT CMAKE_C_COMPILER_ID MATCHES "^XL")
+ run_install_test(file-GET_RUNTIME_DEPENDENCIES-linux)
+ endif()
+ run_install_test(file-GET_RUNTIME_DEPENDENCIES-linux-unresolved)
+ run_install_test(file-GET_RUNTIME_DEPENDENCIES-linux-conflict)
+ run_install_test(file-GET_RUNTIME_DEPENDENCIES-linux-notfile)
+ run_cmake(file-GET_RUNTIME_DEPENDENCIES-project)
+ run_cmake(file-GET_RUNTIME_DEPENDENCIES-badargs1)
+ run_cmake(file-GET_RUNTIME_DEPENDENCIES-badargs2)
+else()
+ run_cmake(file-GET_RUNTIME_DEPENDENCIES-unsupported)
+endif()
+
+set(run_install_test_components 1)
+run_install_test(FILES-EXCLUDE_FROM_ALL)
+run_install_test(TARGETS-EXCLUDE_FROM_ALL)
+run_install_test(TARGETS-NAMELINK_COMPONENT)
+run_install_test(SCRIPT-COMPONENT)
diff --git a/Tests/RunCMake/install/SCRIPT-COMPONENT-all-check.cmake b/Tests/RunCMake/install/SCRIPT-COMPONENT-all-check.cmake
new file mode 100644
index 0000000..48d8e1a
--- /dev/null
+++ b/Tests/RunCMake/install/SCRIPT-COMPONENT-all-check.cmake
@@ -0,0 +1 @@
+check_installed([[^empty1.txt;empty2.txt$]])
diff --git a/Tests/RunCMake/install/SCRIPT-COMPONENT-dev-check.cmake b/Tests/RunCMake/install/SCRIPT-COMPONENT-dev-check.cmake
new file mode 100644
index 0000000..48d8e1a
--- /dev/null
+++ b/Tests/RunCMake/install/SCRIPT-COMPONENT-dev-check.cmake
@@ -0,0 +1 @@
+check_installed([[^empty1.txt;empty2.txt$]])
diff --git a/Tests/RunCMake/install/SCRIPT-COMPONENT-uns-check.cmake b/Tests/RunCMake/install/SCRIPT-COMPONENT-uns-check.cmake
new file mode 100644
index 0000000..e09a102
--- /dev/null
+++ b/Tests/RunCMake/install/SCRIPT-COMPONENT-uns-check.cmake
@@ -0,0 +1 @@
+check_installed([[^$]])
diff --git a/Tests/RunCMake/install/SCRIPT-COMPONENT.cmake b/Tests/RunCMake/install/SCRIPT-COMPONENT.cmake
new file mode 100644
index 0000000..aaa9bd4
--- /dev/null
+++ b/Tests/RunCMake/install/SCRIPT-COMPONENT.cmake
@@ -0,0 +1,5 @@
+install(
+ SCRIPT "${CMAKE_CURRENT_SOURCE_DIR}/install_script.cmake"
+ CODE "write_empty_file(empty2.txt)"
+ COMPONENT dev
+ )
diff --git a/Tests/RunCMake/install/SCRIPT-all-check.cmake b/Tests/RunCMake/install/SCRIPT-all-check.cmake
new file mode 100644
index 0000000..48d8e1a
--- /dev/null
+++ b/Tests/RunCMake/install/SCRIPT-all-check.cmake
@@ -0,0 +1 @@
+check_installed([[^empty1.txt;empty2.txt$]])
diff --git a/Tests/RunCMake/install/SCRIPT.cmake b/Tests/RunCMake/install/SCRIPT.cmake
new file mode 100644
index 0000000..f857b54
--- /dev/null
+++ b/Tests/RunCMake/install/SCRIPT.cmake
@@ -0,0 +1,4 @@
+install(
+ SCRIPT "${CMAKE_CURRENT_SOURCE_DIR}/install_script.cmake"
+ CODE "write_empty_file(empty2.txt)"
+ )
diff --git a/Tests/RunCMake/install/SkipInstallRulesNoWarning1-check.cmake b/Tests/RunCMake/install/SkipInstallRulesNoWarning1-check.cmake
new file mode 100644
index 0000000..2807698
--- /dev/null
+++ b/Tests/RunCMake/install/SkipInstallRulesNoWarning1-check.cmake
@@ -0,0 +1,9 @@
+if(NOT EXISTS "${RunCMake_TEST_BINARY_DIR}/CMakeCache.txt")
+ message(FATAL_ERROR "missing test prerequisite CMakeCache.txt")
+endif()
+
+set(CMAKE_INSTALL_CMAKE "${RunCMake_TEST_BINARY_DIR}/cmake_install.cmake")
+
+if(EXISTS ${CMAKE_INSTALL_CMAKE})
+ message(FATAL_ERROR "${CMAKE_INSTALL_CMAKE} should not exist")
+endif()
diff --git a/Tests/RunCMake/install/SkipInstallRulesNoWarning1.cmake b/Tests/RunCMake/install/SkipInstallRulesNoWarning1.cmake
new file mode 100644
index 0000000..22c7f8c
--- /dev/null
+++ b/Tests/RunCMake/install/SkipInstallRulesNoWarning1.cmake
@@ -0,0 +1 @@
+set(CMAKE_SKIP_INSTALL_RULES ON)
diff --git a/Tests/RunCMake/install/SkipInstallRulesNoWarning2-check.cmake b/Tests/RunCMake/install/SkipInstallRulesNoWarning2-check.cmake
new file mode 100644
index 0000000..4372b77
--- /dev/null
+++ b/Tests/RunCMake/install/SkipInstallRulesNoWarning2-check.cmake
@@ -0,0 +1,9 @@
+if(NOT EXISTS "${RunCMake_TEST_BINARY_DIR}/CMakeCache.txt")
+ message(FATAL_ERROR "missing test prerequisite CMakeCache.txt")
+endif()
+
+set(CMAKE_INSTALL_CMAKE "${RunCMake_TEST_BINARY_DIR}/cmake_install.cmake")
+
+if(NOT EXISTS ${CMAKE_INSTALL_CMAKE})
+ message(FATAL_ERROR "${CMAKE_INSTALL_CMAKE} should exist")
+endif()
diff --git a/Tests/RunCMake/install/SkipInstallRulesNoWarning2.cmake b/Tests/RunCMake/install/SkipInstallRulesNoWarning2.cmake
new file mode 100644
index 0000000..2f5f03a
--- /dev/null
+++ b/Tests/RunCMake/install/SkipInstallRulesNoWarning2.cmake
@@ -0,0 +1 @@
+install(FILES CMakeLists.txt DESTINATION src)
diff --git a/Tests/RunCMake/install/SkipInstallRulesWarning-check.cmake b/Tests/RunCMake/install/SkipInstallRulesWarning-check.cmake
new file mode 100644
index 0000000..2807698
--- /dev/null
+++ b/Tests/RunCMake/install/SkipInstallRulesWarning-check.cmake
@@ -0,0 +1,9 @@
+if(NOT EXISTS "${RunCMake_TEST_BINARY_DIR}/CMakeCache.txt")
+ message(FATAL_ERROR "missing test prerequisite CMakeCache.txt")
+endif()
+
+set(CMAKE_INSTALL_CMAKE "${RunCMake_TEST_BINARY_DIR}/cmake_install.cmake")
+
+if(EXISTS ${CMAKE_INSTALL_CMAKE})
+ message(FATAL_ERROR "${CMAKE_INSTALL_CMAKE} should not exist")
+endif()
diff --git a/Tests/RunCMake/install/SkipInstallRulesWarning-stderr.txt b/Tests/RunCMake/install/SkipInstallRulesWarning-stderr.txt
new file mode 100644
index 0000000..9130526
--- /dev/null
+++ b/Tests/RunCMake/install/SkipInstallRulesWarning-stderr.txt
@@ -0,0 +1,3 @@
+CMake Warning in CMakeLists.txt:
+ CMAKE_SKIP_INSTALL_RULES was enabled even though installation rules have
+ been specified
diff --git a/Tests/RunCMake/install/SkipInstallRulesWarning.cmake b/Tests/RunCMake/install/SkipInstallRulesWarning.cmake
new file mode 100644
index 0000000..b621d9b
--- /dev/null
+++ b/Tests/RunCMake/install/SkipInstallRulesWarning.cmake
@@ -0,0 +1,2 @@
+set(CMAKE_SKIP_INSTALL_RULES ON)
+install(FILES CMakeLists.txt DESTINATION src)
diff --git a/Tests/RunCMake/install/TARGETS-Apple-Defaults-result.txt b/Tests/RunCMake/install/TARGETS-Apple-Defaults-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/install/TARGETS-Apple-Defaults-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/install/TARGETS-Apple-Defaults-stderr.txt b/Tests/RunCMake/install/TARGETS-Apple-Defaults-stderr.txt
new file mode 100644
index 0000000..645882f
--- /dev/null
+++ b/Tests/RunCMake/install/TARGETS-Apple-Defaults-stderr.txt
@@ -0,0 +1,12 @@
+^CMake Error at TARGETS-Apple-Defaults\.cmake:[0-9]+ \(install\):
+ install TARGETS given no BUNDLE DESTINATION for MACOSX_BUNDLE executable
+ target "exe"\.
+Call Stack \(most recent call first\):
+ CMakeLists\.txt:[0-9]+ \(include\)
+
+
+CMake Error at TARGETS-Apple-Defaults\.cmake:[0-9]+ \(install\):
+ install TARGETS given no FRAMEWORK DESTINATION for shared library FRAMEWORK
+ target "lib1"\.
+Call Stack \(most recent call first\):
+ CMakeLists\.txt:[0-9]+ \(include\)$
diff --git a/Tests/RunCMake/install/TARGETS-Apple-Defaults.cmake b/Tests/RunCMake/install/TARGETS-Apple-Defaults.cmake
new file mode 100644
index 0000000..b60c318
--- /dev/null
+++ b/Tests/RunCMake/install/TARGETS-Apple-Defaults.cmake
@@ -0,0 +1,8 @@
+enable_language(C)
+
+add_executable(exe MACOSX_BUNDLE main.c)
+add_library(lib1 SHARED obj1.c)
+set_property(TARGET lib1 PROPERTY FRAMEWORK ON)
+
+install(TARGETS exe)
+install(TARGETS lib1)
diff --git a/Tests/RunCMake/install/TARGETS-CONFIGURATIONS-all-check.cmake b/Tests/RunCMake/install/TARGETS-CONFIGURATIONS-all-check.cmake
new file mode 100644
index 0000000..2866e7f
--- /dev/null
+++ b/Tests/RunCMake/install/TARGETS-CONFIGURATIONS-all-check.cmake
@@ -0,0 +1 @@
+check_installed([[^src;src/main-d.c$]])
diff --git a/Tests/RunCMake/install/TARGETS-CONFIGURATIONS.cmake b/Tests/RunCMake/install/TARGETS-CONFIGURATIONS.cmake
new file mode 100644
index 0000000..5531cd2
--- /dev/null
+++ b/Tests/RunCMake/install/TARGETS-CONFIGURATIONS.cmake
@@ -0,0 +1,2 @@
+install(FILES main.c DESTINATION src CONFIGURATIONS Debug RENAME main-d.c)
+install(FILES main.c DESTINATION src CONFIGURATIONS Release RENAME main-r.c)
diff --git a/Tests/RunCMake/install/TARGETS-DESTINATION-bad-result.txt b/Tests/RunCMake/install/TARGETS-DESTINATION-bad-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/install/TARGETS-DESTINATION-bad-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/install/TARGETS-DESTINATION-bad-stderr.txt b/Tests/RunCMake/install/TARGETS-DESTINATION-bad-stderr.txt
new file mode 100644
index 0000000..9844158
--- /dev/null
+++ b/Tests/RunCMake/install/TARGETS-DESTINATION-bad-stderr.txt
@@ -0,0 +1,6 @@
+CMake Error:
+ Error evaluating generator expression:
+
+ \$<NOTAGENEX>
+
+ Expression did not evaluate to a known generator expression
diff --git a/Tests/RunCMake/install/TARGETS-DESTINATION-bad.cmake b/Tests/RunCMake/install/TARGETS-DESTINATION-bad.cmake
new file mode 100644
index 0000000..feff52df
--- /dev/null
+++ b/Tests/RunCMake/install/TARGETS-DESTINATION-bad.cmake
@@ -0,0 +1,3 @@
+enable_language(C)
+add_library(empty empty.c)
+install(TARGETS empty DESTINATION $<NOTAGENEX>)
diff --git a/Tests/RunCMake/install/TARGETS-Defaults-Cache-all-check.cmake b/Tests/RunCMake/install/TARGETS-Defaults-Cache-all-check.cmake
new file mode 100644
index 0000000..4a55cd6
--- /dev/null
+++ b/Tests/RunCMake/install/TARGETS-Defaults-Cache-all-check.cmake
@@ -0,0 +1,46 @@
+if(WIN32)
+ set(_check_files
+ [[lib3]]
+ [[lib3/(lib)?lib3\.(dll\.a|lib)]]
+ [[lib4]]
+ [[lib4/(lib)?lib4\.dll]]
+ [[mybin]]
+ [[mybin/exe\.exe]]
+ [[mybin/(lib)?lib1\.dll]]
+ [[myinclude]]
+ [[myinclude/obj3\.h]]
+ [[mylib]]
+ [[mylib/(lib)?lib1\.(dll\.a|lib)]]
+ [[mylib/(lib)?lib2\.(a|lib)]]
+ )
+elseif(CYGWIN)
+ set(_check_files
+ [[lib3]]
+ [[lib3/liblib3\.dll\.a]]
+ [[lib4]]
+ [[lib4/cyglib4\.dll]]
+ [[mybin]]
+ [[mybin/cyglib1\.dll]]
+ [[mybin/exe\.exe]]
+ [[myinclude]]
+ [[myinclude/obj3\.h]]
+ [[mylib]]
+ [[mylib/liblib1\.dll\.a]]
+ [[mylib/liblib2\.a]]
+ )
+else()
+ set(_check_files
+ [[lib3]]
+ [[lib3/liblib3\.(dylib|so)]]
+ [[lib4]]
+ [[lib4/liblib4\.(dylib|so)]]
+ [[mybin]]
+ [[mybin/exe]]
+ [[myinclude]]
+ [[myinclude/obj3\.h]]
+ [[mylib]]
+ [[mylib/liblib1\.(dylib|so)]]
+ [[mylib/liblib2\.a]]
+ )
+endif()
+check_installed("^${_check_files}$")
diff --git a/Tests/RunCMake/install/TARGETS-Defaults-Cache-stderr.txt b/Tests/RunCMake/install/TARGETS-Defaults-Cache-stderr.txt
new file mode 100644
index 0000000..1939097
--- /dev/null
+++ b/Tests/RunCMake/install/TARGETS-Defaults-Cache-stderr.txt
@@ -0,0 +1,2 @@
+^INSTALL TARGETS - target lib3 has PRIVATE_HEADER files but no PRIVATE_HEADER DESTINATION\.
+INSTALL TARGETS - target lib4 has PUBLIC_HEADER files but no PUBLIC_HEADER DESTINATION\.$
diff --git a/Tests/RunCMake/install/TARGETS-Defaults-Cache.cmake b/Tests/RunCMake/install/TARGETS-Defaults-Cache.cmake
new file mode 100644
index 0000000..58c5273
--- /dev/null
+++ b/Tests/RunCMake/install/TARGETS-Defaults-Cache.cmake
@@ -0,0 +1,20 @@
+enable_language(C)
+
+add_executable(exe main.c)
+add_library(lib1 SHARED obj1.c)
+set_property(TARGET lib1 PROPERTY PUBLIC_HEADER ${CMAKE_CURRENT_SOURCE_DIR}/obj3.h)
+add_library(lib2 STATIC obj3.c)
+add_library(lib3 SHARED obj4.c)
+set_property(TARGET lib3 PROPERTY PRIVATE_HEADER ${CMAKE_CURRENT_SOURCE_DIR}/obj4.h)
+add_library(lib4 SHARED obj5.c)
+set_property(TARGET lib4 PROPERTY PUBLIC_HEADER ${CMAKE_CURRENT_SOURCE_DIR}/obj5.h)
+
+install(TARGETS exe lib1 lib2)
+install(TARGETS lib3
+ LIBRARY DESTINATION lib3
+ ARCHIVE DESTINATION lib3
+ )
+install(TARGETS lib4
+ LIBRARY DESTINATION lib4
+ RUNTIME DESTINATION lib4
+ )
diff --git a/Tests/RunCMake/install/TARGETS-Defaults-all-check.cmake b/Tests/RunCMake/install/TARGETS-Defaults-all-check.cmake
new file mode 100644
index 0000000..30f2266
--- /dev/null
+++ b/Tests/RunCMake/install/TARGETS-Defaults-all-check.cmake
@@ -0,0 +1,52 @@
+if(WIN32)
+ set(_check_files
+ [[bin]]
+ [[bin/exe\.exe]]
+ [[bin/(lib)?lib1\.dll]]
+ [[include]]
+ [[include/obj1\.h]]
+ [[include/obj2\.h]]
+ [[include/obj3\.h]]
+ [[lib]]
+ [[lib/(lib)?lib1\.(dll\.a|lib)]]
+ [[lib/(lib)?lib2\.(a|lib)]]
+ [[lib3]]
+ [[lib3/(lib)?lib3\.(dll\.a|lib)]]
+ [[lib4]]
+ [[lib4/(lib)?lib4\.dll]]
+ )
+elseif(CYGWIN)
+ set(_check_files
+ [[bin]]
+ [[bin/cyglib1\.dll]]
+ [[bin/exe\.exe]]
+ [[include]]
+ [[include/obj1\.h]]
+ [[include/obj2\.h]]
+ [[include/obj3\.h]]
+ [[lib]]
+ [[lib/liblib1\.dll\.a]]
+ [[lib/liblib2\.a]]
+ [[lib3]]
+ [[lib3/liblib3\.dll\.a]]
+ [[lib4]]
+ [[lib4/cyglib4\.dll]]
+ )
+else()
+ set(_check_files
+ [[bin]]
+ [[bin/exe]]
+ [[include]]
+ [[include/obj1\.h]]
+ [[include/obj2\.h]]
+ [[include/obj3\.h]]
+ [[lib]]
+ [[lib/liblib1\.(dylib|so)]]
+ [[lib/liblib2\.a]]
+ [[lib3]]
+ [[lib3/liblib3\.(dylib|so)]]
+ [[lib4]]
+ [[lib4/liblib4\.(dylib|so)]]
+ )
+endif()
+check_installed("^${_check_files}$")
diff --git a/Tests/RunCMake/install/TARGETS-Defaults-stderr.txt b/Tests/RunCMake/install/TARGETS-Defaults-stderr.txt
new file mode 100644
index 0000000..1939097
--- /dev/null
+++ b/Tests/RunCMake/install/TARGETS-Defaults-stderr.txt
@@ -0,0 +1,2 @@
+^INSTALL TARGETS - target lib3 has PRIVATE_HEADER files but no PRIVATE_HEADER DESTINATION\.
+INSTALL TARGETS - target lib4 has PUBLIC_HEADER files but no PUBLIC_HEADER DESTINATION\.$
diff --git a/Tests/RunCMake/install/TARGETS-Defaults.cmake b/Tests/RunCMake/install/TARGETS-Defaults.cmake
new file mode 100644
index 0000000..a580657
--- /dev/null
+++ b/Tests/RunCMake/install/TARGETS-Defaults.cmake
@@ -0,0 +1,28 @@
+enable_language(C)
+
+add_executable(exe main.c)
+add_library(lib1 SHARED obj1.c)
+set_property(TARGET lib1 PROPERTY PUBLIC_HEADER ${CMAKE_CURRENT_SOURCE_DIR}/obj3.h)
+add_library(lib2 STATIC obj3.c)
+add_library(lib3 SHARED obj4.c)
+set_property(TARGET lib3 PROPERTY PRIVATE_HEADER ${CMAKE_CURRENT_SOURCE_DIR}/obj4.h)
+add_library(lib4 SHARED obj5.c)
+set_property(TARGET lib4 PROPERTY PUBLIC_HEADER ${CMAKE_CURRENT_SOURCE_DIR}/obj5.h)
+
+add_library(iface INTERFACE)
+set_target_properties(iface PROPERTIES
+ PUBLIC_HEADER ${CMAKE_CURRENT_SOURCE_DIR}/obj1.h
+ PRIVATE_HEADER ${CMAKE_CURRENT_SOURCE_DIR}/obj2.h)
+
+install(TARGETS exe lib1 lib2)
+install(TARGETS lib3
+ LIBRARY DESTINATION lib3
+ ARCHIVE DESTINATION lib3
+ )
+install(TARGETS lib4
+ LIBRARY DESTINATION lib4
+ RUNTIME DESTINATION lib4
+ )
+install(TARGETS iface
+ PUBLIC_HEADER DESTINATION include
+ PRIVATE_HEADER DESTINATION include)
diff --git a/Tests/RunCMake/install/TARGETS-EXCLUDE_FROM_ALL-all-check.cmake b/Tests/RunCMake/install/TARGETS-EXCLUDE_FROM_ALL-all-check.cmake
new file mode 100644
index 0000000..9b538bb
--- /dev/null
+++ b/Tests/RunCMake/install/TARGETS-EXCLUDE_FROM_ALL-all-check.cmake
@@ -0,0 +1 @@
+check_installed([[^bin-all;bin-all/myexe(\.exe)?$]])
diff --git a/Tests/RunCMake/install/TARGETS-EXCLUDE_FROM_ALL-exc-check.cmake b/Tests/RunCMake/install/TARGETS-EXCLUDE_FROM_ALL-exc-check.cmake
new file mode 100644
index 0000000..aef0d27
--- /dev/null
+++ b/Tests/RunCMake/install/TARGETS-EXCLUDE_FROM_ALL-exc-check.cmake
@@ -0,0 +1 @@
+check_installed([[^bin-exc;bin-exc/myexe(\.exe)?$]])
diff --git a/Tests/RunCMake/install/TARGETS-EXCLUDE_FROM_ALL-uns-check.cmake b/Tests/RunCMake/install/TARGETS-EXCLUDE_FROM_ALL-uns-check.cmake
new file mode 100644
index 0000000..56fd264
--- /dev/null
+++ b/Tests/RunCMake/install/TARGETS-EXCLUDE_FROM_ALL-uns-check.cmake
@@ -0,0 +1 @@
+check_installed([[^bin-all;bin-all/myexe(\.exe)?;bin-uns;bin-uns/myexe(\.exe)?$]])
diff --git a/Tests/RunCMake/install/TARGETS-EXCLUDE_FROM_ALL.cmake b/Tests/RunCMake/install/TARGETS-EXCLUDE_FROM_ALL.cmake
new file mode 100644
index 0000000..6fb2036
--- /dev/null
+++ b/Tests/RunCMake/install/TARGETS-EXCLUDE_FROM_ALL.cmake
@@ -0,0 +1,5 @@
+enable_language(C)
+add_executable(myexe main.c)
+install(TARGETS myexe DESTINATION bin-all)
+install(TARGETS myexe DESTINATION bin-uns EXCLUDE_FROM_ALL)
+install(TARGETS myexe DESTINATION bin-exc EXCLUDE_FROM_ALL COMPONENT exc)
diff --git a/Tests/RunCMake/install/TARGETS-FILE_RPATH_CHANGE-check-common.cmake b/Tests/RunCMake/install/TARGETS-FILE_RPATH_CHANGE-check-common.cmake
new file mode 100644
index 0000000..673fdde
--- /dev/null
+++ b/Tests/RunCMake/install/TARGETS-FILE_RPATH_CHANGE-check-common.cmake
@@ -0,0 +1,30 @@
+file(READ ${RunCMake_TEST_BINARY_DIR}/cmake_install.cmake install_script)
+#message(STATUS ${install_script})
+
+set(wsnl " *[\n\r]+ *") # whitespace + single newline + whitespace
+set(wssl " *[\n\r]+[^\n\r]*[\n\r]+ *") # ws nl skipline nl ws
+string(CONCAT prefix [[file\(RPATH_CHANGE]])
+set(_msg "cmake_install.cmake does not match ")
+
+macro(check)
+ if(NOT install_script MATCHES "${regex}")
+ message(STATUS "${test} - check \"${target}\" - FAILED:")
+ string(CONCAT RunCMake_TEST_FAILED "${_msg}" ">>>${regex}<<<")
+ return()
+ else()
+ message(STATUS "${test} - check \"${target}\" - PASSED")
+ endif()
+endmacro()
+
+macro(skip_without_rpath_change_rule)
+# Not all platforms generate a file(RPATH_CHANGE) rule
+ if(NOT install_script MATCHES [[file\(RPATH_CHANGE]])
+ # Sanity check against a platform known to generate a file(RPATH_CHANGE) rule
+ if(CMAKE_SYSTEM_NAME STREQUAL "Linux")
+ message(FATAL_ERROR "Expected generated file(RPATH_CHANGE) rule on platform Linux.")
+ else()
+ message(STATUS "${test} - All checks skipped. No file(RPATH_CHANGE) rule found on this platform.")
+ return()
+ endif()
+ endif()
+endmacro()
diff --git a/Tests/RunCMake/install/TARGETS-FILE_RPATH_CHANGE-new_rpath-check.cmake b/Tests/RunCMake/install/TARGETS-FILE_RPATH_CHANGE-new_rpath-check.cmake
new file mode 100644
index 0000000..930ef70
--- /dev/null
+++ b/Tests/RunCMake/install/TARGETS-FILE_RPATH_CHANGE-new_rpath-check.cmake
@@ -0,0 +1,63 @@
+include(${RunCMake_SOURCE_DIR}/TARGETS-FILE_RPATH_CHANGE-check-common.cmake)
+skip_without_rpath_change_rule()
+string(APPEND prefix "${wsnl}" [[FILE "[^"]*/]])
+
+set(target "exe1_cmp0095_old")
+string(CONCAT regex "${prefix}${target}\"${wssl}"
+ [[NEW_RPATH "/foo/bar]])
+check()
+
+set(target "exe1_cmp0095_warn")
+string(CONCAT regex "${prefix}${target}\"${wssl}"
+ [[NEW_RPATH "/foo/bar]])
+check()
+
+set(target "exe1_cmp0095_new")
+string(CONCAT regex "${prefix}${target}\"${wssl}"
+ [[NEW_RPATH "/foo/bar]])
+check()
+
+set(target "exe2_cmp0095_old")
+string(CONCAT regex "${prefix}${target}\"${wssl}"
+ [[NEW_RPATH "\$ORIGIN/../lib]])
+check()
+
+set(target "exe2_cmp0095_warn")
+string(CONCAT regex "${prefix}${target}\"${wssl}"
+ [[NEW_RPATH "\$ORIGIN/../lib]])
+check()
+
+set(target "exe2_cmp0095_new")
+string(CONCAT regex "${prefix}${target}\"${wssl}"
+ [[NEW_RPATH "\\\$ORIGIN/../lib]])
+check()
+
+set(target "exe3_cmp0095_old")
+string(CONCAT regex "${prefix}${target}\"${wssl}"
+ [[NEW_RPATH "\${ORIGIN}/../lib]])
+check()
+
+set(target "exe3_cmp0095_warn")
+string(CONCAT regex "${prefix}${target}\"${wssl}"
+ [[NEW_RPATH "\${ORIGIN}/../lib]])
+check()
+
+set(target "exe3_cmp0095_new")
+string(CONCAT regex "${prefix}${target}\"${wssl}"
+ [[NEW_RPATH "\\\${ORIGIN}/../lib]])
+check()
+
+set(target "exe4_cmp0095_old")
+string(CONCAT regex "${prefix}${target}\"${wssl}"
+ [[NEW_RPATH "/foo/bar/\${PLATFORM}]])
+check()
+
+set(target "exe4_cmp0095_warn")
+string(CONCAT regex "${prefix}${target}\"${wssl}"
+ [[NEW_RPATH "/foo/bar/\${PLATFORM}]])
+check()
+
+set(target "exe4_cmp0095_new")
+string(CONCAT regex "${prefix}${target}\"${wssl}"
+ [[NEW_RPATH "/foo/bar/\\\${PLATFORM}]])
+check()
diff --git a/Tests/RunCMake/install/TARGETS-FILE_RPATH_CHANGE-new_rpath-stderr.txt b/Tests/RunCMake/install/TARGETS-FILE_RPATH_CHANGE-new_rpath-stderr.txt
new file mode 100644
index 0000000..2561263
--- /dev/null
+++ b/Tests/RunCMake/install/TARGETS-FILE_RPATH_CHANGE-new_rpath-stderr.txt
@@ -0,0 +1,23 @@
+CMake Warning \(dev\) at TARGETS-FILE_RPATH_CHANGE-new_rpath\.cmake:[0-9]+ \(install\):
+ Policy CMP0095 is not set: RPATH entries are properly escaped in the
+ intermediary CMake install script\. Run "cmake --help-policy CMP0095" for
+ policy details\. Use the cmake_policy command to set the policy and
+ suppress this warning\.
+
+ RPATH entries for target 'exe3_cmp0095_warn' will not be escaped in the
+ intermediary cmake_install\.cmake script\.
+Call Stack \(most recent call first\):
+ CMakeLists\.txt:[0-9]+ \(include\)
+This warning is for project developers\. Use -Wno-dev to suppress it\.
+
+CMake Warning \(dev\) at TARGETS-FILE_RPATH_CHANGE-new_rpath\.cmake:[0-9]+ \(install\):
+ Policy CMP0095 is not set: RPATH entries are properly escaped in the
+ intermediary CMake install script\. Run "cmake --help-policy CMP0095" for
+ policy details\. Use the cmake_policy command to set the policy and
+ suppress this warning\.
+
+ RPATH entries for target 'exe4_cmp0095_warn' will not be escaped in the
+ intermediary cmake_install\.cmake script\.
+Call Stack \(most recent call first\):
+ CMakeLists\.txt:[0-9]+ \(include\)
+This warning is for project developers\. Use -Wno-dev to suppress it\.
diff --git a/Tests/RunCMake/install/TARGETS-FILE_RPATH_CHANGE-new_rpath.cmake b/Tests/RunCMake/install/TARGETS-FILE_RPATH_CHANGE-new_rpath.cmake
new file mode 100644
index 0000000..cba04b2
--- /dev/null
+++ b/Tests/RunCMake/install/TARGETS-FILE_RPATH_CHANGE-new_rpath.cmake
@@ -0,0 +1,72 @@
+cmake_minimum_required(VERSION 3.14)
+enable_language(C)
+
+# test matrix
+#
+# A :=
+# | no cmake syntax | cmake syntax |
+# -----------------------+-----------------+--------------+
+# absolute install RPATH | exe1 | exe4 |
+# relative install RPATH | exe2 | exe3 |
+#
+# all := A * CMP005_OLD + A * CMP0095_WARN + A * CMP0095_NEW
+
+add_library(utils SHARED obj1.c)
+set(targets utils)
+
+set(exe1_install_rpath "/foo/bar")
+set(exe2_install_rpath "\$ORIGIN/../lib")
+set(exe3_install_rpath "\${ORIGIN}/../lib")
+set(exe4_install_rpath "/foo/bar/\${PLATFORM}")
+
+macro(A_CMP0095 policy_value)
+ cmake_policy(PUSH)
+ if(NOT "x${policy_value}x" STREQUAL "xWARNx")
+ cmake_policy(SET CMP0095 ${policy_value})
+ endif()
+ string(TOLOWER "${policy_value}" p)
+
+ # exe1: absolute install RPATH, no cmake syntax
+ set(case "exe1")
+ set(target "${case}_cmp0095_${p}")
+ list(APPEND targets ${target})
+ add_executable(${target} main.c)
+ target_link_libraries(${target} PRIVATE utils)
+ set_target_properties(${target} PROPERTIES
+ INSTALL_RPATH "${${case}_install_rpath}")
+
+ # exe2: relative install RPATH, no cmake syntax
+ set(case "exe2")
+ set(target "${case}_cmp0095_${p}")
+ list(APPEND targets ${target})
+ add_executable(${target} main.c)
+ target_link_libraries(${target} PRIVATE utils)
+ set_target_properties(${target} PROPERTIES
+ INSTALL_RPATH "${${case}_install_rpath}")
+
+ # exe3: relative install RPATH, cmake syntax
+ set(case "exe3")
+ set(target "${case}_cmp0095_${p}")
+ list(APPEND targets ${target})
+ add_executable(${target} main.c)
+ target_link_libraries(${target} PRIVATE utils)
+ set_target_properties(${target} PROPERTIES
+ INSTALL_RPATH "${${case}_install_rpath}")
+
+ # exe4: absolute install RPATH, cmake syntax
+ set(case "exe4")
+ set(target "${case}_cmp0095_${p}")
+ list(APPEND targets ${target})
+ add_executable(${target} main.c)
+ target_link_libraries(${target} PRIVATE utils)
+ set_target_properties(${target} PROPERTIES
+ INSTALL_RPATH "${${case}_install_rpath}")
+
+ cmake_policy(POP)
+endmacro()
+
+A_CMP0095("OLD")
+A_CMP0095("WARN") # exe3 and exe4 are expected to issue an author warning
+A_CMP0095("NEW")
+
+install(TARGETS ${targets})
diff --git a/Tests/RunCMake/install/TARGETS-FILE_RPATH_CHANGE-old_rpath-check.cmake b/Tests/RunCMake/install/TARGETS-FILE_RPATH_CHANGE-old_rpath-check.cmake
new file mode 100644
index 0000000..814f405
--- /dev/null
+++ b/Tests/RunCMake/install/TARGETS-FILE_RPATH_CHANGE-old_rpath-check.cmake
@@ -0,0 +1,15 @@
+include(${RunCMake_SOURCE_DIR}/TARGETS-FILE_RPATH_CHANGE-check-common.cmake)
+skip_without_rpath_change_rule()
+string(APPEND prefix "${wsnl}" [[FILE "[^"]*/]])
+
+set(target "exe1")
+string(CONCAT regex "${prefix}${target}\"${wsnl}"
+ [[OLD_RPATH "]] "${RunCMake_BINARY_DIR}")
+check()
+
+if("x${CMAKE_SHARED_LIBRARY_RPATH_ORIGIN_TOKEN}" STREQUAL "x\$ORIGIN")
+ set(target "exe2")
+ string(CONCAT regex "${prefix}${target}\"${wsnl}"
+ [[OLD_RPATH "\\\$ORIGIN]])
+ check()
+endif()
diff --git a/Tests/RunCMake/install/TARGETS-FILE_RPATH_CHANGE-old_rpath.cmake b/Tests/RunCMake/install/TARGETS-FILE_RPATH_CHANGE-old_rpath.cmake
new file mode 100644
index 0000000..43ae787
--- /dev/null
+++ b/Tests/RunCMake/install/TARGETS-FILE_RPATH_CHANGE-old_rpath.cmake
@@ -0,0 +1,18 @@
+cmake_minimum_required(VERSION 3.14)
+enable_language(C)
+
+add_library(utils SHARED obj1.c)
+
+# exe1: absolute build RPATH, no cmake syntax
+set(CMAKE_BUILD_RPATH_USE_ORIGIN OFF)
+set(CMAKE_INSTALL_RPATH "/foo/bar")
+add_executable(exe1 main.c)
+target_link_libraries(exe1 PRIVATE utils)
+
+# exe2: relative build RPATH, no cmake syntax
+set(CMAKE_BUILD_RPATH_USE_ORIGIN ON)
+set(CMAKE_INSTALL_RPATH "/foo/bar")
+add_executable(exe2 main.c)
+target_link_libraries(exe2 PRIVATE utils)
+
+install(TARGETS utils exe1 exe2)
diff --git a/Tests/RunCMake/install/TARGETS-ImportedGlobal-result.txt b/Tests/RunCMake/install/TARGETS-ImportedGlobal-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/install/TARGETS-ImportedGlobal-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/install/TARGETS-ImportedGlobal-stderr.txt b/Tests/RunCMake/install/TARGETS-ImportedGlobal-stderr.txt
new file mode 100644
index 0000000..d67802b
--- /dev/null
+++ b/Tests/RunCMake/install/TARGETS-ImportedGlobal-stderr.txt
@@ -0,0 +1,4 @@
+^CMake Error at TARGETS-ImportedGlobal.cmake:[0-9]+ \(install\):
+ install TARGETS given target "imported_global" which does not exist.
+Call Stack \(most recent call first\):
+ CMakeLists.txt:[0-9]+ \(include\)$
diff --git a/Tests/RunCMake/install/TARGETS-ImportedGlobal.cmake b/Tests/RunCMake/install/TARGETS-ImportedGlobal.cmake
new file mode 100644
index 0000000..08c20bd
--- /dev/null
+++ b/Tests/RunCMake/install/TARGETS-ImportedGlobal.cmake
@@ -0,0 +1,3 @@
+add_library(imported_global STATIC IMPORTED GLOBAL)
+set_property(TARGET imported_global PROPERTY IMPORTED_LOCATION /does_not_exist)
+install(TARGETS imported_global DESTINATION bin)
diff --git a/Tests/RunCMake/install/TARGETS-InstallFromSubDir-all-check.cmake b/Tests/RunCMake/install/TARGETS-InstallFromSubDir-all-check.cmake
new file mode 100644
index 0000000..1d747c3
--- /dev/null
+++ b/Tests/RunCMake/install/TARGETS-InstallFromSubDir-all-check.cmake
@@ -0,0 +1 @@
+check_installed([[^bin;bin/myexe(\.exe)?;bin/subexe(\.exe)?$]])
diff --git a/Tests/RunCMake/install/TARGETS-InstallFromSubDir.cmake b/Tests/RunCMake/install/TARGETS-InstallFromSubDir.cmake
new file mode 100644
index 0000000..8615d6e
--- /dev/null
+++ b/Tests/RunCMake/install/TARGETS-InstallFromSubDir.cmake
@@ -0,0 +1,4 @@
+enable_language(C)
+add_executable(myexe main.c)
+add_subdirectory(TARGETS-InstallFromSubDir)
+install(TARGETS myexe subexe DESTINATION bin)
diff --git a/Tests/RunCMake/install/TARGETS-InstallFromSubDir/CMakeLists.txt b/Tests/RunCMake/install/TARGETS-InstallFromSubDir/CMakeLists.txt
new file mode 100644
index 0000000..477d938
--- /dev/null
+++ b/Tests/RunCMake/install/TARGETS-InstallFromSubDir/CMakeLists.txt
@@ -0,0 +1 @@
+add_executable(subexe ../main.c)
diff --git a/Tests/RunCMake/install/TARGETS-NAMELINK_COMPONENT-all-check.cmake b/Tests/RunCMake/install/TARGETS-NAMELINK_COMPONENT-all-check.cmake
new file mode 100644
index 0000000..bc9ebd1
--- /dev/null
+++ b/Tests/RunCMake/install/TARGETS-NAMELINK_COMPONENT-all-check.cmake
@@ -0,0 +1,73 @@
+if(WIN32)
+ set(_check_files
+ [[lib]]
+ [[lib/(lib)?namelink-none\.dll]]
+ [[lib/(lib)?namelink-same\.dll]]
+ [[lib/(lib)?namelink-sep\.dll]]
+ [[lib/(lib)?namelink-skip\.dll]]
+ [[lib/(lib)?namelink-uns-dev\.dll]]
+ [[lib/(lib)?namelink-uns\.dll]]
+ )
+elseif(CYGWIN)
+ set(_check_files
+ [[lib]]
+ [[lib/cygnamelink-none\.dll]]
+ [[lib/cygnamelink-same-1\.dll]]
+ [[lib/cygnamelink-sep-1\.dll]]
+ [[lib/cygnamelink-skip-1\.dll]]
+ [[lib/cygnamelink-uns-1\.dll]]
+ [[lib/cygnamelink-uns-dev-1\.dll]]
+ )
+elseif(APPLE)
+ set(_check_files
+ [[lib]]
+ [[lib/libnamelink-none\.dylib]]
+ [[lib/libnamelink-only\.dylib]]
+ [[lib/libnamelink-same\.1\.0\.dylib]]
+ [[lib/libnamelink-same\.1\.dylib]]
+ [[lib/libnamelink-same\.dylib]]
+ [[lib/libnamelink-sep\.1\.0\.dylib]]
+ [[lib/libnamelink-sep\.1\.dylib]]
+ [[lib/libnamelink-sep\.dylib]]
+ [[lib/libnamelink-skip\.1\.0\.dylib]]
+ [[lib/libnamelink-skip\.1\.dylib]]
+ [[lib/libnamelink-uns-dev\.1\.0\.dylib]]
+ [[lib/libnamelink-uns-dev\.1\.dylib]]
+ [[lib/libnamelink-uns-dev\.dylib]]
+ [[lib/libnamelink-uns\.1\.0\.dylib]]
+ [[lib/libnamelink-uns\.1\.dylib]]
+ [[lib/libnamelink-uns\.dylib]]
+ )
+elseif(NO_NAMELINK)
+ set(_check_files
+ [[lib]]
+ [[lib/libnamelink-none\.so]]
+ [[lib/libnamelink-same\.so]]
+ [[lib/libnamelink-sep\.so]]
+ [[lib/libnamelink-skip\.so]]
+ [[lib/libnamelink-uns-dev\.so]]
+ [[lib/libnamelink-uns\.so]]
+ )
+else()
+ set(_check_files
+ [[lib]]
+ [[lib/libnamelink-none\.so]]
+ [[lib/libnamelink-only\.so]]
+ [[lib/libnamelink-same\.so]]
+ [[lib/libnamelink-same\.so\.1]]
+ [[lib/libnamelink-same\.so\.1\.0]]
+ [[lib/libnamelink-sep\.so]]
+ [[lib/libnamelink-sep\.so\.1]]
+ [[lib/libnamelink-sep\.so\.1\.0]]
+ [[lib/libnamelink-skip\.so\.1]]
+ [[lib/libnamelink-skip\.so\.1\.0]]
+ [[lib/libnamelink-uns-dev\.so]]
+ [[lib/libnamelink-uns-dev\.so\.1]]
+ [[lib/libnamelink-uns-dev\.so\.1\.0]]
+ [[lib/libnamelink-uns\.so]]
+ [[lib/libnamelink-uns\.so\.1]]
+ [[lib/libnamelink-uns\.so\.1\.0]]
+ )
+endif()
+
+check_installed("^${_check_files}$")
diff --git a/Tests/RunCMake/install/TARGETS-NAMELINK_COMPONENT-bad-all-result.txt b/Tests/RunCMake/install/TARGETS-NAMELINK_COMPONENT-bad-all-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/install/TARGETS-NAMELINK_COMPONENT-bad-all-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/install/TARGETS-NAMELINK_COMPONENT-bad-all-stderr.txt b/Tests/RunCMake/install/TARGETS-NAMELINK_COMPONENT-bad-all-stderr.txt
new file mode 100644
index 0000000..fe65fd3
--- /dev/null
+++ b/Tests/RunCMake/install/TARGETS-NAMELINK_COMPONENT-bad-all-stderr.txt
@@ -0,0 +1,5 @@
+^CMake Error at TARGETS-NAMELINK_COMPONENT-bad-all\.cmake:5 \(install\):
+ install TARGETS given NAMELINK_COMPONENT option not in LIBRARY group\. The
+ NAMELINK_COMPONENT option may be specified only following LIBRARY\.
+Call Stack \(most recent call first\):
+ CMakeLists\.txt:[0-9]+ \(include\)$
diff --git a/Tests/RunCMake/install/TARGETS-NAMELINK_COMPONENT-bad-all.cmake b/Tests/RunCMake/install/TARGETS-NAMELINK_COMPONENT-bad-all.cmake
new file mode 100644
index 0000000..701d093
--- /dev/null
+++ b/Tests/RunCMake/install/TARGETS-NAMELINK_COMPONENT-bad-all.cmake
@@ -0,0 +1,9 @@
+enable_language(C)
+
+add_library(namelink-lib empty.c)
+
+install(TARGETS namelink-lib
+ DESTINATION lib
+ COMPONENT lib
+ NAMELINK_COMPONENT dev
+)
diff --git a/Tests/RunCMake/install/TARGETS-NAMELINK_COMPONENT-bad-exc-result.txt b/Tests/RunCMake/install/TARGETS-NAMELINK_COMPONENT-bad-exc-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/install/TARGETS-NAMELINK_COMPONENT-bad-exc-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/install/TARGETS-NAMELINK_COMPONENT-bad-exc-stderr.txt b/Tests/RunCMake/install/TARGETS-NAMELINK_COMPONENT-bad-exc-stderr.txt
new file mode 100644
index 0000000..60f52c4
--- /dev/null
+++ b/Tests/RunCMake/install/TARGETS-NAMELINK_COMPONENT-bad-exc-stderr.txt
@@ -0,0 +1,5 @@
+^CMake Error at TARGETS-NAMELINK_COMPONENT-bad-exc\.cmake:5 \(install\):
+ install TARGETS given NAMELINK_COMPONENT option not in LIBRARY group\. The
+ NAMELINK_COMPONENT option may be specified only following LIBRARY\.
+Call Stack \(most recent call first\):
+ CMakeLists\.txt:[0-9]+ \(include\)$
diff --git a/Tests/RunCMake/install/TARGETS-NAMELINK_COMPONENT-bad-exc.cmake b/Tests/RunCMake/install/TARGETS-NAMELINK_COMPONENT-bad-exc.cmake
new file mode 100644
index 0000000..19c12d4
--- /dev/null
+++ b/Tests/RunCMake/install/TARGETS-NAMELINK_COMPONENT-bad-exc.cmake
@@ -0,0 +1,10 @@
+enable_language(C)
+
+add_executable(namelink-exc main.c)
+
+install(TARGETS namelink-exc
+ RUNTIME
+ DESTINATION bin
+ COMPONENT exc
+ NAMELINK_COMPONENT dev
+)
diff --git a/Tests/RunCMake/install/TARGETS-NAMELINK_COMPONENT-dev-check.cmake b/Tests/RunCMake/install/TARGETS-NAMELINK_COMPONENT-dev-check.cmake
new file mode 100644
index 0000000..5396cdb
--- /dev/null
+++ b/Tests/RunCMake/install/TARGETS-NAMELINK_COMPONENT-dev-check.cmake
@@ -0,0 +1,11 @@
+if(WIN32 OR CYGWIN OR NO_NAMELINK)
+ set(_check_files)
+else()
+ set(_check_files
+ [[lib]]
+ [[lib/libnamelink-only\.(so|dylib)]]
+ [[lib/libnamelink-sep\.(so|dylib)]]
+ [[lib/libnamelink-uns-dev\.(so|dylib)]]
+ )
+endif()
+check_installed("^${_check_files}$")
diff --git a/Tests/RunCMake/install/TARGETS-NAMELINK_COMPONENT-lib-check.cmake b/Tests/RunCMake/install/TARGETS-NAMELINK_COMPONENT-lib-check.cmake
new file mode 100644
index 0000000..3f6be68
--- /dev/null
+++ b/Tests/RunCMake/install/TARGETS-NAMELINK_COMPONENT-lib-check.cmake
@@ -0,0 +1,50 @@
+if(WIN32)
+ set(_check_files
+ [[lib]]
+ [[lib/(lib)?namelink-none\.dll]]
+ [[lib/(lib)?namelink-same\.dll]]
+ [[lib/(lib)?namelink-sep\.dll]]
+ [[lib/(lib)?namelink-skip\.dll]]
+ )
+elseif(CYGWIN)
+ set(_check_files
+ [[lib]]
+ [[lib/cygnamelink-none\.dll]]
+ [[lib/cygnamelink-same-1\.dll]]
+ [[lib/cygnamelink-sep-1\.dll]]
+ [[lib/cygnamelink-skip-1\.dll]]
+ )
+elseif(APPLE)
+ set(_check_files
+ [[lib]]
+ [[lib/libnamelink-none\.dylib]]
+ [[lib/libnamelink-same\.1\.0\.dylib]]
+ [[lib/libnamelink-same\.1\.dylib]]
+ [[lib/libnamelink-same\.dylib]]
+ [[lib/libnamelink-sep\.1\.0\.dylib]]
+ [[lib/libnamelink-sep\.1\.dylib]]
+ [[lib/libnamelink-skip\.1\.0\.dylib]]
+ [[lib/libnamelink-skip\.1\.dylib]]
+ )
+elseif(NO_NAMELINK)
+ set(_check_files
+ [[lib]]
+ [[lib/libnamelink-none\.so]]
+ [[lib/libnamelink-same\.so]]
+ [[lib/libnamelink-sep\.so]]
+ [[lib/libnamelink-skip\.so]]
+ )
+else()
+ set(_check_files
+ [[lib]]
+ [[lib/libnamelink-none\.so]]
+ [[lib/libnamelink-same\.so]]
+ [[lib/libnamelink-same\.so\.1]]
+ [[lib/libnamelink-same\.so\.1\.0]]
+ [[lib/libnamelink-sep\.so\.1]]
+ [[lib/libnamelink-sep\.so\.1\.0]]
+ [[lib/libnamelink-skip\.so\.1]]
+ [[lib/libnamelink-skip\.so\.1\.0]]
+ )
+endif()
+check_installed("^${_check_files}$")
diff --git a/Tests/RunCMake/install/TARGETS-NAMELINK_COMPONENT-uns-check.cmake b/Tests/RunCMake/install/TARGETS-NAMELINK_COMPONENT-uns-check.cmake
new file mode 100644
index 0000000..0033c88
--- /dev/null
+++ b/Tests/RunCMake/install/TARGETS-NAMELINK_COMPONENT-uns-check.cmake
@@ -0,0 +1,38 @@
+if(WIN32)
+ set(_check_files
+ [[lib]]
+ [[lib/(lib)?namelink-uns-dev\.dll]]
+ [[lib/(lib)?namelink-uns\.dll]]
+ )
+elseif(CYGWIN)
+ set(_check_files
+ [[lib]]
+ [[lib/cygnamelink-uns-1\.dll]]
+ [[lib/cygnamelink-uns-dev-1\.dll]]
+ )
+elseif(APPLE)
+ set(_check_files
+ [[lib]]
+ [[lib/libnamelink-uns-dev\.1\.0\.dylib]]
+ [[lib/libnamelink-uns-dev\.1\.dylib]]
+ [[lib/libnamelink-uns\.1\.0\.dylib]]
+ [[lib/libnamelink-uns\.1\.dylib]]
+ [[lib/libnamelink-uns\.dylib]]
+ )
+elseif(NO_NAMELINK)
+ set(_check_files
+ [[lib]]
+ [[lib/libnamelink-uns-dev\.so]]
+ [[lib/libnamelink-uns\.so]]
+ )
+else()
+ set(_check_files
+ [[lib]]
+ [[lib/libnamelink-uns-dev\.so\.1]]
+ [[lib/libnamelink-uns-dev\.so\.1\.0]]
+ [[lib/libnamelink-uns\.so]]
+ [[lib/libnamelink-uns\.so\.1]]
+ [[lib/libnamelink-uns\.so\.1\.0]]
+ )
+endif()
+check_installed("^${_check_files}$")
diff --git a/Tests/RunCMake/install/TARGETS-NAMELINK_COMPONENT.cmake b/Tests/RunCMake/install/TARGETS-NAMELINK_COMPONENT.cmake
new file mode 100644
index 0000000..0e684e1
--- /dev/null
+++ b/Tests/RunCMake/install/TARGETS-NAMELINK_COMPONENT.cmake
@@ -0,0 +1,68 @@
+enable_language(C)
+
+macro(add_versioned_library NAME)
+ add_library(${NAME} SHARED obj1.c)
+ set_target_properties(${NAME} PROPERTIES
+ VERSION 1.0
+ SOVERSION 1
+ )
+endmacro()
+
+add_versioned_library(namelink-sep)
+add_versioned_library(namelink-same)
+add_versioned_library(namelink-uns)
+add_versioned_library(namelink-uns-dev)
+add_versioned_library(namelink-only)
+add_versioned_library(namelink-skip)
+add_library(namelink-none SHARED obj1.c)
+
+install(TARGETS namelink-sep namelink-none
+ RUNTIME
+ DESTINATION lib
+ COMPONENT lib
+ LIBRARY
+ DESTINATION lib
+ COMPONENT lib
+ NAMELINK_COMPONENT dev
+)
+install(TARGETS namelink-same
+ RUNTIME
+ DESTINATION lib
+ COMPONENT lib
+ LIBRARY
+ DESTINATION lib
+ COMPONENT lib
+)
+install(TARGETS namelink-uns
+ RUNTIME
+ DESTINATION lib
+ LIBRARY
+ DESTINATION lib
+)
+install(TARGETS namelink-uns-dev
+ RUNTIME
+ DESTINATION lib
+ LIBRARY
+ DESTINATION lib
+ NAMELINK_COMPONENT dev
+)
+install(TARGETS namelink-only
+ RUNTIME
+ DESTINATION lib
+ COMPONENT lib
+ LIBRARY
+ DESTINATION lib
+ COMPONENT lib
+ NAMELINK_COMPONENT dev
+ NAMELINK_ONLY
+)
+install(TARGETS namelink-skip
+ RUNTIME
+ DESTINATION lib
+ COMPONENT lib
+ LIBRARY
+ DESTINATION lib
+ COMPONENT lib
+ NAMELINK_COMPONENT dev
+ NAMELINK_SKIP
+)
diff --git a/Tests/RunCMake/install/TARGETS-OPTIONAL-all-check.cmake b/Tests/RunCMake/install/TARGETS-OPTIONAL-all-check.cmake
new file mode 100644
index 0000000..bcf71dd
--- /dev/null
+++ b/Tests/RunCMake/install/TARGETS-OPTIONAL-all-check.cmake
@@ -0,0 +1 @@
+check_installed([[^bin;bin/myexe(\.exe)?$]])
diff --git a/Tests/RunCMake/install/TARGETS-OPTIONAL.cmake b/Tests/RunCMake/install/TARGETS-OPTIONAL.cmake
new file mode 100644
index 0000000..d3c5cda
--- /dev/null
+++ b/Tests/RunCMake/install/TARGETS-OPTIONAL.cmake
@@ -0,0 +1,4 @@
+enable_language(C)
+add_executable(myexe main.c)
+add_executable(notall EXCLUDE_FROM_ALL main.c)
+install(TARGETS myexe notall DESTINATION bin OPTIONAL)
diff --git a/Tests/RunCMake/install/TARGETS-OUTPUT_NAME-all-check.cmake b/Tests/RunCMake/install/TARGETS-OUTPUT_NAME-all-check.cmake
new file mode 100644
index 0000000..5daecc8
--- /dev/null
+++ b/Tests/RunCMake/install/TARGETS-OUTPUT_NAME-all-check.cmake
@@ -0,0 +1,13 @@
+if(WIN32)
+ set(test123 [[bin/test1out\.exe;bin/test2deb\.exe;bin/test3exc\.exe]])
+ set(libtest45 [[bin/libtest4\.dll;bin/libtest4\.dll\.a;bin/libtest5ar\.a]])
+ set(test45 [[bin/test4\.dll;bin/test4\.lib;bin/test5ar\.lib]])
+
+ check_installed("^bin;(${libtest45};${test123})|(${test123};${test45})\$")
+elseif(CYGWIN)
+ check_installed([[^bin;bin/cygtest4\.dll;bin/libtest4\.dll\.a;bin/libtest5ar\.a;bin/test1out\.exe;bin/test2deb\.exe;bin/test3exc\.exe$]])
+elseif(APPLE)
+ check_installed([[^bin;bin/libtest4lib\.dylib;bin/libtest5ar\.a;bin/test1out;bin/test2deb;bin/test3exc$]])
+else()
+ check_installed([[^bin;bin/libtest4lib\.so;bin/libtest5ar\.a;bin/test1out;bin/test2deb;bin/test3exc$]])
+endif()
diff --git a/Tests/RunCMake/install/TARGETS-OUTPUT_NAME.cmake b/Tests/RunCMake/install/TARGETS-OUTPUT_NAME.cmake
new file mode 100644
index 0000000..67e7069
--- /dev/null
+++ b/Tests/RunCMake/install/TARGETS-OUTPUT_NAME.cmake
@@ -0,0 +1,27 @@
+enable_language(C)
+
+add_executable(test1 main.c)
+set_property(TARGET test1 PROPERTY OUTPUT_NAME test1out)
+set_property(TARGET test1 PROPERTY RELEASE_OUTPUT_NAME test1rel)
+
+add_executable(test2 main.c)
+set_property(TARGET test2 PROPERTY OUTPUT_NAME test2out)
+set_property(TARGET test2 PROPERTY DEBUG_OUTPUT_NAME test2deb)
+
+add_executable(test3 main.c)
+set_property(TARGET test3 PROPERTY RUNTIME_OUTPUT_NAME test3exc)
+
+add_library(test4 SHARED obj1.c)
+set_property(TARGET test4 PROPERTY LIBRARY_OUTPUT_NAME test4lib)
+
+add_library(test5 STATIC obj1.c)
+set_property(TARGET test5 PROPERTY ARCHIVE_OUTPUT_NAME test5ar)
+
+install(TARGETS
+ test1
+ test2
+ test3
+ test4
+ test5
+ DESTINATION bin
+ )
diff --git a/Tests/RunCMake/install/TARGETS-Parts-all-check.cmake b/Tests/RunCMake/install/TARGETS-Parts-all-check.cmake
new file mode 100644
index 0000000..6245839
--- /dev/null
+++ b/Tests/RunCMake/install/TARGETS-Parts-all-check.cmake
@@ -0,0 +1 @@
+check_installed([[^include;include/obj1\.h;lib;lib/(mylib\.lib|(lib|cyg)mylib\.a)$]])
diff --git a/Tests/RunCMake/install/TARGETS-Parts.cmake b/Tests/RunCMake/install/TARGETS-Parts.cmake
new file mode 100644
index 0000000..2a46ab9
--- /dev/null
+++ b/Tests/RunCMake/install/TARGETS-Parts.cmake
@@ -0,0 +1,7 @@
+enable_language(C)
+add_library(mylib STATIC obj1.c)
+set_property(TARGET mylib PROPERTY PUBLIC_HEADER obj1.h)
+install(TARGETS mylib
+ ARCHIVE DESTINATION lib
+ PUBLIC_HEADER DESTINATION include
+ )
diff --git a/Tests/RunCMake/install/TARGETS-RPATH-all-check.cmake b/Tests/RunCMake/install/TARGETS-RPATH-all-check.cmake
new file mode 100644
index 0000000..fa52d65
--- /dev/null
+++ b/Tests/RunCMake/install/TARGETS-RPATH-all-check.cmake
@@ -0,0 +1,14 @@
+execute_process(
+ COMMAND "${CMAKE_INSTALL_PREFIX}/bin/myexe"
+ RESULT_VARIABLE MYEXE_RESULT
+ OUTPUT_VARIABLE MYEXE_OUTPUT
+ ERROR_VARIABLE MYEXE_ERROR
+ )
+
+if(NOT MYEXE_RESULT EQUAL "0")
+ set(RunCMake_TEST_FAILED "myexe returned [${MYEXE_RESULT}], was expecting [0]")
+elseif(NOT MYEXE_OUTPUT STREQUAL "")
+ set(RunCMake_TEST_FAILED "myexe printed nonempty output:\n${MYEXE_OUTPUT}")
+elseif(NOT MYEXE_ERROR STREQUAL "")
+ set(RunCMake_TEST_FAILED "myexe printed nonempty error:\n${MYEXE_ERROR}")
+endif()
diff --git a/Tests/RunCMake/install/TARGETS-RPATH.cmake b/Tests/RunCMake/install/TARGETS-RPATH.cmake
new file mode 100644
index 0000000..b75deff
--- /dev/null
+++ b/Tests/RunCMake/install/TARGETS-RPATH.cmake
@@ -0,0 +1,14 @@
+cmake_minimum_required(VERSION 3.9)
+
+enable_language(C)
+
+set(CMAKE_BUILD_WITH_INSTALL_RPATH 1)
+add_library(mylib SHARED obj1.c)
+add_executable(myexe testobj1.c)
+target_link_libraries(myexe mylib)
+set_property(TARGET myexe PROPERTY INSTALL_RPATH "${CMAKE_CURRENT_BINARY_DIR}/root-all/bin")
+set_target_properties(mylib PROPERTIES VERSION 1.0 SOVERSION 1)
+
+install(TARGETS mylib myexe
+ DESTINATION bin
+ )
diff --git a/Tests/RunCMake/install/dir/empty.txt b/Tests/RunCMake/install/dir/empty.txt
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/Tests/RunCMake/install/dir/empty.txt
diff --git a/Tests/RunCMake/install/empty.c b/Tests/RunCMake/install/empty.c
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/Tests/RunCMake/install/empty.c
diff --git a/Tests/RunCMake/install/file-GET_RUNTIME_DEPENDENCIES-badargs1-result.txt b/Tests/RunCMake/install/file-GET_RUNTIME_DEPENDENCIES-badargs1-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/install/file-GET_RUNTIME_DEPENDENCIES-badargs1-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/install/file-GET_RUNTIME_DEPENDENCIES-badargs1-stderr.txt b/Tests/RunCMake/install/file-GET_RUNTIME_DEPENDENCIES-badargs1-stderr.txt
new file mode 100644
index 0000000..b66d1fe
--- /dev/null
+++ b/Tests/RunCMake/install/file-GET_RUNTIME_DEPENDENCIES-badargs1-stderr.txt
@@ -0,0 +1,18 @@
+^CMake Warning \(dev\) at file-GET_RUNTIME_DEPENDENCIES-badargs1\.cmake:[0-9]+ \(file\):
+ You have used file\(GET_RUNTIME_DEPENDENCIES\) in project mode\. This is
+ probably not what you intended to do\. Instead, please consider using it in
+ an install\(CODE\) or install\(SCRIPT\) command\. For example:
+
+ install\(CODE \[\[
+ file\(GET_RUNTIME_DEPENDENCIES
+ # \.\.\.
+ \)
+ ]]\)
+Call Stack \(most recent call first\):
+ CMakeLists\.txt:[0-9]+ \(include\)
+This warning is for project developers\. Use -Wno-dev to suppress it\.
+
+CMake Error at file-GET_RUNTIME_DEPENDENCIES-badargs1\.cmake:[0-9]+ \(file\):
+ file Unrecognized argument: "invalid"
+Call Stack \(most recent call first\):
+ CMakeLists\.txt:[0-9]+ \(include\)$
diff --git a/Tests/RunCMake/install/file-GET_RUNTIME_DEPENDENCIES-badargs1.cmake b/Tests/RunCMake/install/file-GET_RUNTIME_DEPENDENCIES-badargs1.cmake
new file mode 100644
index 0000000..f3b8ce4
--- /dev/null
+++ b/Tests/RunCMake/install/file-GET_RUNTIME_DEPENDENCIES-badargs1.cmake
@@ -0,0 +1,2 @@
+file(GET_RUNTIME_DEPENDENCIES invalid)
+message(FATAL_ERROR "This message should not be displayed")
diff --git a/Tests/RunCMake/install/file-GET_RUNTIME_DEPENDENCIES-badargs2-result.txt b/Tests/RunCMake/install/file-GET_RUNTIME_DEPENDENCIES-badargs2-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/install/file-GET_RUNTIME_DEPENDENCIES-badargs2-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/install/file-GET_RUNTIME_DEPENDENCIES-badargs2-stderr.txt b/Tests/RunCMake/install/file-GET_RUNTIME_DEPENDENCIES-badargs2-stderr.txt
new file mode 100644
index 0000000..50fa81f
--- /dev/null
+++ b/Tests/RunCMake/install/file-GET_RUNTIME_DEPENDENCIES-badargs2-stderr.txt
@@ -0,0 +1,23 @@
+^CMake Warning \(dev\) at file-GET_RUNTIME_DEPENDENCIES-badargs2\.cmake:[0-9]+ \(file\):
+ You have used file\(GET_RUNTIME_DEPENDENCIES\) in project mode\. This is
+ probably not what you intended to do\. Instead, please consider using it in
+ an install\(CODE\) or install\(SCRIPT\) command\. For example:
+
+ install\(CODE \[\[
+ file\(GET_RUNTIME_DEPENDENCIES
+ # \.\.\.
+ \)
+ ]]\)
+Call Stack \(most recent call first\):
+ CMakeLists\.txt:[0-9]+ \(include\)
+This warning is for project developers\. Use -Wno-dev to suppress it\.
+
+CMake Error at file-GET_RUNTIME_DEPENDENCIES-badargs2\.cmake:[0-9]+ \(file\):
+ file Keywords missing values:
+
+ RESOLVED_DEPENDENCIES_VAR
+ UNRESOLVED_DEPENDENCIES_VAR
+ CONFLICTING_DEPENDENCIES_PREFIX
+ BUNDLE_EXECUTABLE
+Call Stack \(most recent call first\):
+ CMakeLists\.txt:[0-9]+ \(include\)$
diff --git a/Tests/RunCMake/install/file-GET_RUNTIME_DEPENDENCIES-badargs2.cmake b/Tests/RunCMake/install/file-GET_RUNTIME_DEPENDENCIES-badargs2.cmake
new file mode 100644
index 0000000..ac6af85
--- /dev/null
+++ b/Tests/RunCMake/install/file-GET_RUNTIME_DEPENDENCIES-badargs2.cmake
@@ -0,0 +1,15 @@
+file(GET_RUNTIME_DEPENDENCIES
+ RESOLVED_DEPENDENCIES_VAR
+ UNRESOLVED_DEPENDENCIES_VAR
+ CONFLICTING_DEPENDENCIES_PREFIX
+ BUNDLE_EXECUTABLE
+ EXECUTABLES
+ LIBRARIES
+ MODULES
+ DIRECTORIES
+ PRE_INCLUDE_REGEXES
+ PRE_EXCLUDE_REGEXES
+ POST_INCLUDE_REGEXES
+ POST_EXCLUDE_REGEXES
+ )
+message(FATAL_ERROR "This message should not be displayed")
diff --git a/Tests/RunCMake/install/file-GET_RUNTIME_DEPENDENCIES-linux-all-check.cmake b/Tests/RunCMake/install/file-GET_RUNTIME_DEPENDENCIES-linux-all-check.cmake
new file mode 100644
index 0000000..ab630f0
--- /dev/null
+++ b/Tests/RunCMake/install/file-GET_RUNTIME_DEPENDENCIES-linux-all-check.cmake
@@ -0,0 +1,44 @@
+function(check_contents filename contents_regex)
+ if(EXISTS "${CMAKE_INSTALL_PREFIX}/${filename}")
+ file(READ "${CMAKE_INSTALL_PREFIX}/${filename}" contents)
+ if(NOT contents MATCHES "${contents_regex}")
+ string(APPEND RunCMake_TEST_FAILED "File contents:
+ ${contents}
+do not match what we expected:
+ ${contents_regex}
+in file:
+ ${CMAKE_INSTALL_PREFIX}/${filename}\n")
+ set(RunCMake_TEST_FAILED "${RunCMake_TEST_FAILED}" PARENT_SCOPE)
+ endif()
+ else()
+ string(APPEND RunCMake_TEST_FAILED "File ${CMAKE_INSTALL_PREFIX}/${filename} does not exist")
+ set(RunCMake_TEST_FAILED "${RunCMake_TEST_FAILED}" PARENT_SCOPE)
+ endif()
+endfunction()
+
+set(_check
+ [[[^;]*/Tests/RunCMake/install/file-GET_RUNTIME_DEPENDENCIES-linux-build/root-all/lib/libtest_rpath\.so]]
+ [[[^;]*/Tests/RunCMake/install/file-GET_RUNTIME_DEPENDENCIES-linux-build/root-all/lib/libtest_runpath\.so]]
+ [[[^;]*/Tests/RunCMake/install/file-GET_RUNTIME_DEPENDENCIES-linux-build/root-all/lib/rpath/librpath\.so]]
+ [[[^;]*/Tests/RunCMake/install/file-GET_RUNTIME_DEPENDENCIES-linux-build/root-all/lib/rpath_parent/librpath_parent\.so]]
+ [[[^;]*/Tests/RunCMake/install/file-GET_RUNTIME_DEPENDENCIES-linux-build/root-all/lib/rpath_search/librpath_search\.so]]
+ [[[^;]*/Tests/RunCMake/install/file-GET_RUNTIME_DEPENDENCIES-linux-build/root-all/lib/runpath/librunpath\.so]]
+ [[[^;]*/Tests/RunCMake/install/file-GET_RUNTIME_DEPENDENCIES-linux-build/root-all/lib/runpath_search/librunpath_search\.so]]
+ )
+check_contents(deps/deps1.txt "^${_check}$")
+check_contents(deps/deps2.txt "^${_check}$")
+check_contents(deps/deps3.txt "^${_check}$")
+set(_check
+ [[librpath_unresolved\.so]]
+ [[librunpath_parent_unresolved\.so]]
+ [[librunpath_unresolved\.so]]
+ )
+check_contents(deps/udeps1.txt "^${_check}$")
+check_contents(deps/udeps2.txt "^${_check}$")
+check_contents(deps/udeps3.txt "^${_check}$")
+set(_check
+ "^libconflict\\.so:[^;]*/Tests/RunCMake/install/file-GET_RUNTIME_DEPENDENCIES-linux-build/root-all/lib/conflict/libconflict\\.so;[^;]*/Tests/RunCMake/install/file-GET_RUNTIME_DEPENDENCIES-linux-build/root-all/lib/conflict2/libconflict\\.so\n$"
+ )
+check_contents(deps/cdeps1.txt "${_check}")
+check_contents(deps/cdeps2.txt "${_check}")
+check_contents(deps/cdeps3.txt "${_check}")
diff --git a/Tests/RunCMake/install/file-GET_RUNTIME_DEPENDENCIES-linux-all-stderr.txt b/Tests/RunCMake/install/file-GET_RUNTIME_DEPENDENCIES-linux-all-stderr.txt
new file mode 100644
index 0000000..123ae48
--- /dev/null
+++ b/Tests/RunCMake/install/file-GET_RUNTIME_DEPENDENCIES-linux-all-stderr.txt
@@ -0,0 +1,119 @@
+^CMake Warning at cmake_install\.cmake:[0-9]+ \(file\):
+ Dependency librpath_search_postexcluded\.so found in search directory:
+
+ [^
+]*/Tests/RunCMake/install/file-GET_RUNTIME_DEPENDENCIES-linux-build/root-all/lib/rpath_search_postexcluded
+
+ See file\(GET_RUNTIME_DEPENDENCIES\) documentation for more information\.
+Call Stack \(most recent call first\):
+ cmake_install\.cmake:[0-9]+ \(exec_get_runtime_dependencies\)
+
+*CMake Warning at cmake_install\.cmake:[0-9]+ \(file\):
+ Dependency librpath_search\.so found in search directory:
+
+ [^
+]*/Tests/RunCMake/install/file-GET_RUNTIME_DEPENDENCIES-linux-build/root-all/lib/rpath_search
+
+ See file\(GET_RUNTIME_DEPENDENCIES\) documentation for more information\.
+Call Stack \(most recent call first\):
+ cmake_install\.cmake:[0-9]+ \(exec_get_runtime_dependencies\)
+
+*CMake Warning at cmake_install\.cmake:[0-9]+ \(file\):
+ Dependency librunpath_search_postexcluded\.so found in search directory:
+
+ [^
+]*/Tests/RunCMake/install/file-GET_RUNTIME_DEPENDENCIES-linux-build/root-all/lib/runpath_search_postexcluded
+
+ See file\(GET_RUNTIME_DEPENDENCIES\) documentation for more information\.
+Call Stack \(most recent call first\):
+ cmake_install\.cmake:[0-9]+ \(exec_get_runtime_dependencies\)
+
+*CMake Warning at cmake_install\.cmake:[0-9]+ \(file\):
+ Dependency librunpath_search\.so found in search directory:
+
+ [^
+]*/Tests/RunCMake/install/file-GET_RUNTIME_DEPENDENCIES-linux-build/root-all/lib/runpath_search
+
+ See file\(GET_RUNTIME_DEPENDENCIES\) documentation for more information\.
+Call Stack \(most recent call first\):
+ cmake_install\.cmake:[0-9]+ \(exec_get_runtime_dependencies\)
+
+*CMake Warning at cmake_install\.cmake:[0-9]+ \(file\):
+ Dependency librpath_search_postexcluded\.so found in search directory:
+
+ [^
+]*/Tests/RunCMake/install/file-GET_RUNTIME_DEPENDENCIES-linux-build/root-all/lib/rpath_search_postexcluded
+
+ See file\(GET_RUNTIME_DEPENDENCIES\) documentation for more information\.
+Call Stack \(most recent call first\):
+ cmake_install\.cmake:[0-9]+ \(exec_get_runtime_dependencies\)
+
+*CMake Warning at cmake_install\.cmake:[0-9]+ \(file\):
+ Dependency librpath_search\.so found in search directory:
+
+ [^
+]*/Tests/RunCMake/install/file-GET_RUNTIME_DEPENDENCIES-linux-build/root-all/lib/rpath_search
+
+ See file\(GET_RUNTIME_DEPENDENCIES\) documentation for more information\.
+Call Stack \(most recent call first\):
+ cmake_install\.cmake:[0-9]+ \(exec_get_runtime_dependencies\)
+
+*CMake Warning at cmake_install\.cmake:[0-9]+ \(file\):
+ Dependency librunpath_search_postexcluded\.so found in search directory:
+
+ [^
+]*/Tests/RunCMake/install/file-GET_RUNTIME_DEPENDENCIES-linux-build/root-all/lib/runpath_search_postexcluded
+
+ See file\(GET_RUNTIME_DEPENDENCIES\) documentation for more information\.
+Call Stack \(most recent call first\):
+ cmake_install\.cmake:[0-9]+ \(exec_get_runtime_dependencies\)
+
+*CMake Warning at cmake_install\.cmake:[0-9]+ \(file\):
+ Dependency librunpath_search\.so found in search directory:
+
+ [^
+]*/Tests/RunCMake/install/file-GET_RUNTIME_DEPENDENCIES-linux-build/root-all/lib/runpath_search
+
+ See file\(GET_RUNTIME_DEPENDENCIES\) documentation for more information\.
+Call Stack \(most recent call first\):
+ cmake_install\.cmake:[0-9]+ \(exec_get_runtime_dependencies\)
+
+*CMake Warning at cmake_install\.cmake:[0-9]+ \(file\):
+ Dependency librpath_search_postexcluded\.so found in search directory:
+
+ [^
+]*/Tests/RunCMake/install/file-GET_RUNTIME_DEPENDENCIES-linux-build/root-all/lib/rpath_search_postexcluded
+
+ See file\(GET_RUNTIME_DEPENDENCIES\) documentation for more information\.
+Call Stack \(most recent call first\):
+ cmake_install\.cmake:[0-9]+ \(exec_get_runtime_dependencies\)
+
+*CMake Warning at cmake_install\.cmake:[0-9]+ \(file\):
+ Dependency librpath_search\.so found in search directory:
+
+ [^
+]*/Tests/RunCMake/install/file-GET_RUNTIME_DEPENDENCIES-linux-build/root-all/lib/rpath_search
+
+ See file\(GET_RUNTIME_DEPENDENCIES\) documentation for more information\.
+Call Stack \(most recent call first\):
+ cmake_install\.cmake:[0-9]+ \(exec_get_runtime_dependencies\)
+
+*CMake Warning at cmake_install\.cmake:[0-9]+ \(file\):
+ Dependency librunpath_search_postexcluded\.so found in search directory:
+
+ [^
+]*/Tests/RunCMake/install/file-GET_RUNTIME_DEPENDENCIES-linux-build/root-all/lib/runpath_search_postexcluded
+
+ See file\(GET_RUNTIME_DEPENDENCIES\) documentation for more information\.
+Call Stack \(most recent call first\):
+ cmake_install\.cmake:[0-9]+ \(exec_get_runtime_dependencies\)
+
+*CMake Warning at cmake_install\.cmake:[0-9]+ \(file\):
+ Dependency librunpath_search\.so found in search directory:
+
+ [^
+]*/Tests/RunCMake/install/file-GET_RUNTIME_DEPENDENCIES-linux-build/root-all/lib/runpath_search
+
+ See file\(GET_RUNTIME_DEPENDENCIES\) documentation for more information\.
+Call Stack \(most recent call first\):
+ cmake_install\.cmake:[0-9]+ \(exec_get_runtime_dependencies\)$
diff --git a/Tests/RunCMake/install/file-GET_RUNTIME_DEPENDENCIES-linux-conflict-all-result.txt b/Tests/RunCMake/install/file-GET_RUNTIME_DEPENDENCIES-linux-conflict-all-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/install/file-GET_RUNTIME_DEPENDENCIES-linux-conflict-all-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/install/file-GET_RUNTIME_DEPENDENCIES-linux-conflict-all-stderr.txt b/Tests/RunCMake/install/file-GET_RUNTIME_DEPENDENCIES-linux-conflict-all-stderr.txt
new file mode 100644
index 0000000..1692348
--- /dev/null
+++ b/Tests/RunCMake/install/file-GET_RUNTIME_DEPENDENCIES-linux-conflict-all-stderr.txt
@@ -0,0 +1,7 @@
+^CMake Error at cmake_install\.cmake:[0-9]+ \(file\):
+ file Multiple conflicting paths found for librpath\.so:
+
+ [^
+]*/Tests/RunCMake/install/file-GET_RUNTIME_DEPENDENCIES-linux-conflict-build/root-all/lib/rpath1/librpath\.so
+ [^
+]*/Tests/RunCMake/install/file-GET_RUNTIME_DEPENDENCIES-linux-conflict-build/root-all/lib/rpath2/librpath\.so$
diff --git a/Tests/RunCMake/install/file-GET_RUNTIME_DEPENDENCIES-linux-conflict.cmake b/Tests/RunCMake/install/file-GET_RUNTIME_DEPENDENCIES-linux-conflict.cmake
new file mode 100644
index 0000000..f719499
--- /dev/null
+++ b/Tests/RunCMake/install/file-GET_RUNTIME_DEPENDENCIES-linux-conflict.cmake
@@ -0,0 +1,54 @@
+enable_language(C)
+
+set(test1_names rpath)
+set(test2_names rpath)
+
+file(WRITE "${CMAKE_BINARY_DIR}/rpath.c" "void rpath(void) {}\n")
+add_library(rpath SHARED "${CMAKE_BINARY_DIR}/rpath.c")
+install(TARGETS rpath DESTINATION lib/rpath1)
+install(TARGETS rpath DESTINATION lib/rpath2)
+
+file(REMOVE "${CMAKE_BINARY_DIR}/test1.c")
+add_library(test1 SHARED "${CMAKE_BINARY_DIR}/test1.c")
+foreach(name ${test1_names})
+ file(APPEND "${CMAKE_BINARY_DIR}/test1.c" "extern void ${name}(void);\n")
+endforeach()
+file(APPEND "${CMAKE_BINARY_DIR}/test1.c" "void test1(void)\n{\n")
+foreach(name ${test1_names})
+ file(APPEND "${CMAKE_BINARY_DIR}/test1.c" " ${name}();\n")
+endforeach()
+file(APPEND "${CMAKE_BINARY_DIR}/test1.c" "}\n")
+
+target_link_libraries(test1 PRIVATE ${test1_names})
+set_property(TARGET test1 PROPERTY INSTALL_RPATH
+ "${CMAKE_BINARY_DIR}/root-all/lib/rpath1"
+ )
+
+file(REMOVE "${CMAKE_BINARY_DIR}/test2.c")
+add_library(test2 SHARED "${CMAKE_BINARY_DIR}/test2.c")
+foreach(name ${test2_names})
+ file(APPEND "${CMAKE_BINARY_DIR}/test2.c" "extern void ${name}(void);\n")
+endforeach()
+file(APPEND "${CMAKE_BINARY_DIR}/test2.c" "void test2(void)\n{\n")
+foreach(name ${test2_names})
+ file(APPEND "${CMAKE_BINARY_DIR}/test2.c" " ${name}();\n")
+endforeach()
+file(APPEND "${CMAKE_BINARY_DIR}/test2.c" "}\n")
+
+target_link_libraries(test2 PRIVATE ${test2_names})
+set_property(TARGET test2 PROPERTY INSTALL_RPATH
+ "${CMAKE_BINARY_DIR}/root-all/lib/rpath2"
+ )
+
+install(TARGETS test1 test2 DESTINATION lib)
+
+install(CODE [[
+ file(GET_RUNTIME_DEPENDENCIES
+ LIBRARIES
+ "${CMAKE_INSTALL_PREFIX}/lib/$<TARGET_FILE_NAME:test1>"
+ "${CMAKE_INSTALL_PREFIX}/lib/$<TARGET_FILE_NAME:test2>"
+ PRE_INCLUDE_REGEXES "^librpath\\.so$"
+ PRE_EXCLUDE_REGEXES ".*"
+ )
+ message(FATAL_ERROR "This message should not be displayed")
+ ]])
diff --git a/Tests/RunCMake/install/file-GET_RUNTIME_DEPENDENCIES-linux-notfile-all-result.txt b/Tests/RunCMake/install/file-GET_RUNTIME_DEPENDENCIES-linux-notfile-all-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/install/file-GET_RUNTIME_DEPENDENCIES-linux-notfile-all-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/install/file-GET_RUNTIME_DEPENDENCIES-linux-notfile-all-stderr.txt b/Tests/RunCMake/install/file-GET_RUNTIME_DEPENDENCIES-linux-notfile-all-stderr.txt
new file mode 100644
index 0000000..83a87c9
--- /dev/null
+++ b/Tests/RunCMake/install/file-GET_RUNTIME_DEPENDENCIES-linux-notfile-all-stderr.txt
@@ -0,0 +1,5 @@
+^CMake Error at cmake_install\.cmake:[0-9]+ \(file\):
+ file Failed to run objdump on:
+
+ [^
+]*/Tests/RunCMake/install/file-GET_RUNTIME_DEPENDENCIES-linux-notfile-build/root-all/bin/\.\./lib/libtest\.so$
diff --git a/Tests/RunCMake/install/file-GET_RUNTIME_DEPENDENCIES-linux-notfile.cmake b/Tests/RunCMake/install/file-GET_RUNTIME_DEPENDENCIES-linux-notfile.cmake
new file mode 100644
index 0000000..6567438
--- /dev/null
+++ b/Tests/RunCMake/install/file-GET_RUNTIME_DEPENDENCIES-linux-notfile.cmake
@@ -0,0 +1,30 @@
+enable_language(C)
+cmake_policy(SET CMP0095 NEW)
+
+file(WRITE "${CMAKE_BINARY_DIR}/test.c" "void test(void) {}\n")
+file(WRITE "${CMAKE_BINARY_DIR}/main.c" [[extern void test(void);
+
+int main(void)
+{
+ test();
+ return 0;
+}
+]])
+
+add_library(test SHARED "${CMAKE_BINARY_DIR}/test.c")
+add_executable(exe "${CMAKE_BINARY_DIR}/main.c")
+target_link_libraries(exe PRIVATE test)
+set_property(TARGET exe PROPERTY INSTALL_RPATH "\${ORIGIN}/../lib")
+
+install(TARGETS exe DESTINATION bin)
+
+install(CODE [[
+ file(MAKE_DIRECTORY "${CMAKE_INSTALL_PREFIX}/lib/$<TARGET_FILE_NAME:test>")
+ file(GET_RUNTIME_DEPENDENCIES
+ EXECUTABLES
+ "${CMAKE_INSTALL_PREFIX}/bin/$<TARGET_FILE_NAME:exe>"
+ PRE_INCLUDE_REGEXES "^libtest\\.so$"
+ PRE_EXCLUDE_REGEXES ".*"
+ )
+ message(FATAL_ERROR "This message should not be displayed")
+ ]])
diff --git a/Tests/RunCMake/install/file-GET_RUNTIME_DEPENDENCIES-linux-unresolved-all-result.txt b/Tests/RunCMake/install/file-GET_RUNTIME_DEPENDENCIES-linux-unresolved-all-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/install/file-GET_RUNTIME_DEPENDENCIES-linux-unresolved-all-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/install/file-GET_RUNTIME_DEPENDENCIES-linux-unresolved-all-stderr.txt b/Tests/RunCMake/install/file-GET_RUNTIME_DEPENDENCIES-linux-unresolved-all-stderr.txt
new file mode 100644
index 0000000..eaca512
--- /dev/null
+++ b/Tests/RunCMake/install/file-GET_RUNTIME_DEPENDENCIES-linux-unresolved-all-stderr.txt
@@ -0,0 +1,2 @@
+^CMake Error at cmake_install\.cmake:[0-9]+ \(file\):
+ file Could not resolve file libunresolved\.so$
diff --git a/Tests/RunCMake/install/file-GET_RUNTIME_DEPENDENCIES-linux-unresolved.cmake b/Tests/RunCMake/install/file-GET_RUNTIME_DEPENDENCIES-linux-unresolved.cmake
new file mode 100644
index 0000000..3efa305
--- /dev/null
+++ b/Tests/RunCMake/install/file-GET_RUNTIME_DEPENDENCIES-linux-unresolved.cmake
@@ -0,0 +1,18 @@
+enable_language(C)
+
+file(WRITE "${CMAKE_BINARY_DIR}/testlib.c" "extern void unresolved(void);\nvoid testlib(void)\n{\n unresolved();\n}\n")
+add_library(testlib SHARED "${CMAKE_BINARY_DIR}/testlib.c")
+file(WRITE "${CMAKE_BINARY_DIR}/unresolved.c" "void unresolved(void) {}\n")
+add_library(unresolved SHARED "${CMAKE_BINARY_DIR}/unresolved.c")
+target_link_libraries(testlib PRIVATE unresolved)
+install(TARGETS testlib DESTINATION lib)
+
+install(CODE [[
+ file(GET_RUNTIME_DEPENDENCIES
+ PRE_INCLUDE_REGEXES "^libunresolved\\.so$"
+ PRE_EXCLUDE_REGEXES ".*"
+ LIBRARIES
+ "${CMAKE_INSTALL_PREFIX}/lib/$<TARGET_FILE_NAME:testlib>"
+ )
+ message(FATAL_ERROR "This message should not be displayed")
+ ]])
diff --git a/Tests/RunCMake/install/file-GET_RUNTIME_DEPENDENCIES-linux.cmake b/Tests/RunCMake/install/file-GET_RUNTIME_DEPENDENCIES-linux.cmake
new file mode 100644
index 0000000..bd0f9f1
--- /dev/null
+++ b/Tests/RunCMake/install/file-GET_RUNTIME_DEPENDENCIES-linux.cmake
@@ -0,0 +1,169 @@
+enable_language(C)
+cmake_policy(SET CMP0095 NEW)
+
+set(test_rpath_names
+ preexcluded
+ rpath_postexcluded
+ rpath
+ rpath_parent_postexcluded
+ rpath_parent
+ rpath_origin_postexcluded
+ rpath_origin
+ rpath_search_postexcluded
+ rpath_search
+ rpath_unresolved
+ conflict
+ )
+set(test_runpath_names
+ runpath_postexcluded
+ runpath
+ runpath_origin_postexcluded
+ runpath_origin
+ runpath_parent_unresolved
+ runpath_search_postexcluded
+ runpath_search
+ runpath_unresolved
+ )
+
+file(REMOVE "${CMAKE_BINARY_DIR}/test_rpath.c")
+add_library(test_rpath SHARED "${CMAKE_BINARY_DIR}/test_rpath.c")
+foreach(name ${test_rpath_names})
+ file(WRITE "${CMAKE_BINARY_DIR}/${name}.c" "void ${name}(void) {}\n")
+ add_library(${name} SHARED "${CMAKE_BINARY_DIR}/${name}.c")
+
+ file(APPEND "${CMAKE_BINARY_DIR}/test_rpath.c" "extern void ${name}(void);\n")
+endforeach()
+file(APPEND "${CMAKE_BINARY_DIR}/test_rpath.c" "void test_rpath(void)\n{\n")
+foreach(name ${test_rpath_names})
+ file(APPEND "${CMAKE_BINARY_DIR}/test_rpath.c" " ${name}();\n")
+endforeach()
+file(APPEND "${CMAKE_BINARY_DIR}/test_rpath.c" "}\n")
+
+install(TARGETS rpath_postexcluded DESTINATION lib/rpath_postexcluded)
+install(TARGETS rpath DESTINATION lib/rpath)
+install(TARGETS rpath_origin_postexcluded DESTINATION lib/rpath_origin_postexcluded)
+install(TARGETS rpath_origin DESTINATION lib/rpath_origin)
+install(TARGETS rpath_parent_postexcluded DESTINATION lib/rpath_parent_postexcluded)
+install(TARGETS rpath rpath_origin rpath_parent DESTINATION lib/rpath_parent)
+install(TARGETS rpath_search_postexcluded DESTINATION lib/rpath_search_postexcluded)
+install(TARGETS rpath rpath_origin rpath_parent rpath_search DESTINATION lib/rpath_search)
+install(TARGETS conflict DESTINATION lib/conflict)
+
+target_link_libraries(test_rpath PRIVATE ${test_rpath_names})
+set_property(TARGET test_rpath PROPERTY INSTALL_RPATH
+ "${CMAKE_BINARY_DIR}/root-all/lib/rpath_postexcluded"
+ "${CMAKE_BINARY_DIR}/root-all/lib/rpath"
+ "\$ORIGIN/rpath_origin_postexcluded"
+ "\${ORIGIN}/rpath_origin"
+ "${CMAKE_BINARY_DIR}/root-all/lib/conflict"
+ )
+target_link_options(test_rpath PRIVATE -Wl,--disable-new-dtags)
+
+file(REMOVE "${CMAKE_BINARY_DIR}/test_runpath.c")
+add_library(test_runpath SHARED "${CMAKE_BINARY_DIR}/test_runpath.c")
+foreach(name ${test_runpath_names} rpath conflict)
+ file(WRITE "${CMAKE_BINARY_DIR}/${name}.c" "void ${name}(void) {}\n")
+ if(NOT name MATCHES "^(rpath|conflict)$")
+ add_library(${name} SHARED "${CMAKE_BINARY_DIR}/${name}.c")
+ endif()
+
+ file(APPEND "${CMAKE_BINARY_DIR}/test_runpath.c" "extern void ${name}(void);\n")
+endforeach()
+file(APPEND "${CMAKE_BINARY_DIR}/test_runpath.c" "void test_runpath(void)\n{\n")
+foreach(name ${test_runpath_names} rpath conflict)
+ file(APPEND "${CMAKE_BINARY_DIR}/test_runpath.c" " ${name}();\n")
+endforeach()
+file(APPEND "${CMAKE_BINARY_DIR}/test_runpath.c" "}\n")
+
+install(TARGETS runpath_postexcluded DESTINATION lib/runpath_postexcluded)
+install(TARGETS runpath DESTINATION lib/runpath)
+install(TARGETS runpath_origin_postexcluded DESTINATION lib/runpath_origin_postexcluded)
+install(TARGETS runpath_origin DESTINATION lib/runpath_origin)
+install(TARGETS runpath_parent_unresolved DESTINATION lib/runpath_parent_unresolved)
+install(TARGETS runpath_search_postexcluded DESTINATION lib/runpath_search_postexcluded)
+install(TARGETS runpath runpath_origin runpath_search DESTINATION lib/runpath_search)
+install(TARGETS conflict DESTINATION lib/conflict2)
+
+target_link_libraries(test_runpath PRIVATE ${test_runpath_names} rpath conflict)
+set_property(TARGET test_runpath PROPERTY INSTALL_RPATH
+ "${CMAKE_BINARY_DIR}/root-all/lib/runpath/../rpath" # Ensure that files that don't conflict are treated correctly
+ "${CMAKE_BINARY_DIR}/root-all/lib/runpath_postexcluded"
+ "${CMAKE_BINARY_DIR}/root-all/lib/runpath"
+ "\${ORIGIN}/runpath_origin_postexcluded"
+ "\$ORIGIN/runpath_origin"
+ "${CMAKE_BINARY_DIR}/root-all/lib/conflict2"
+ )
+target_link_options(test_runpath PRIVATE -Wl,--enable-new-dtags)
+
+set_property(TARGET test_rpath ${test_rpath_names} test_runpath ${test_runpath_names} PROPERTY LIBRARY_OUTPUT_DIRECTORY lib)
+install(TARGETS test_rpath test_runpath DESTINATION lib)
+
+add_executable(topexe file-GET_RUNTIME_DEPENDENCIES-linux/topexe.c)
+add_library(toplib SHARED file-GET_RUNTIME_DEPENDENCIES-linux/toplib.c)
+add_library(topmod MODULE file-GET_RUNTIME_DEPENDENCIES-linux/toplib.c)
+target_link_libraries(topexe PRIVATE test_rpath test_runpath)
+target_link_libraries(toplib PRIVATE test_rpath test_runpath)
+target_link_libraries(topmod PRIVATE test_rpath test_runpath)
+set_property(TARGET topexe toplib topmod PROPERTY INSTALL_RPATH
+ "${CMAKE_BINARY_DIR}/root-all/lib"
+ "${CMAKE_BINARY_DIR}/root-all/lib/rpath_parent_postexcluded"
+ "${CMAKE_BINARY_DIR}/root-all/lib/rpath_parent"
+ "${CMAKE_BINARY_DIR}/root-all/lib/runpath_parent_unresolved"
+ )
+target_link_options(topexe PRIVATE -Wl,--disable-new-dtags)
+target_link_options(toplib PRIVATE -Wl,--disable-new-dtags)
+target_link_options(topmod PRIVATE -Wl,--disable-new-dtags)
+
+install(TARGETS topexe toplib RUNTIME DESTINATION bin LIBRARY DESTINATION lib)
+install(TARGETS topmod LIBRARY DESTINATION lib/modules)
+
+install(CODE [[
+ function(exec_get_runtime_dependencies depsfile udepsfile cdepsfile)
+ file(GET_RUNTIME_DEPENDENCIES
+ RESOLVED_DEPENDENCIES_VAR deps
+ UNRESOLVED_DEPENDENCIES_VAR udeps
+ CONFLICTING_DEPENDENCIES_PREFIX cdeps
+ PRE_INCLUDE_REGEXES
+ "^lib(test_rpath|rpath_postexcluded|rpath|rpath_parent_postexcluded|rpath_parent|rpath_origin_postexcluded|rpath_origin|rpath_search_postexcluded|rpath_search|rpath_unresolved|test_runpath|runpath_postexcluded|runpath|runpath_origin_postexcluded|runpath_origin|runpath_parent_unresolved|runpath_search_postexcluded|runpath_search|runpath_unresolved|conflict)\\.so$"
+ "^libc\\.so"
+ PRE_EXCLUDE_REGEXES ".*"
+ POST_INCLUDE_REGEXES "^.*/(libtest_rpath|rpath/librpath|rpath_parent/librpath_parent|rpath_search/librpath_search|libtest_runpath|runpath/librunpath|runpath_origin_postexcluded|runpath_origin|runpath_search/librunpath_search|conflict2?/libconflict)\\.so$"
+ POST_EXCLUDE_REGEXES ".*"
+ DIRECTORIES
+ "${CMAKE_INSTALL_PREFIX}/lib/rpath_search_postexcluded"
+ "${CMAKE_INSTALL_PREFIX}/lib/rpath_search"
+ "${CMAKE_INSTALL_PREFIX}/lib/runpath_search_postexcluded"
+ "${CMAKE_INSTALL_PREFIX}/lib/runpath_search"
+ ${ARGN}
+ )
+ list(SORT deps)
+ list(SORT udeps)
+ list(SORT cdeps_FILENAMES)
+ file(WRITE "${CMAKE_INSTALL_PREFIX}/deps/${depsfile}" "${deps}")
+ file(WRITE "${CMAKE_INSTALL_PREFIX}/deps/${udepsfile}" "${udeps}")
+ file(WRITE "${CMAKE_INSTALL_PREFIX}/deps/${cdepsfile}" "")
+ foreach(cdep IN LISTS cdeps_FILENAMES)
+ set(cdep_values ${cdeps_${cdep}})
+ list(SORT cdep_values)
+ file(APPEND "${CMAKE_INSTALL_PREFIX}/deps/${cdepsfile}" "${cdep}:${cdep_values}\n")
+ endforeach()
+ endfunction()
+
+ exec_get_runtime_dependencies(
+ deps1.txt udeps1.txt cdeps1.txt
+ EXECUTABLES
+ "${CMAKE_INSTALL_PREFIX}/bin/$<TARGET_FILE_NAME:topexe>"
+ )
+
+ exec_get_runtime_dependencies(
+ deps2.txt udeps2.txt cdeps2.txt
+ LIBRARIES
+ "${CMAKE_INSTALL_PREFIX}/lib/$<TARGET_FILE_NAME:toplib>"
+ )
+
+ exec_get_runtime_dependencies(
+ deps3.txt udeps3.txt cdeps3.txt
+ MODULES
+ "${CMAKE_INSTALL_PREFIX}/lib/modules/$<TARGET_FILE_NAME:topmod>"
+ )
+ ]])
diff --git a/Tests/RunCMake/install/file-GET_RUNTIME_DEPENDENCIES-linux/topexe.c b/Tests/RunCMake/install/file-GET_RUNTIME_DEPENDENCIES-linux/topexe.c
new file mode 100644
index 0000000..d196afe
--- /dev/null
+++ b/Tests/RunCMake/install/file-GET_RUNTIME_DEPENDENCIES-linux/topexe.c
@@ -0,0 +1,9 @@
+extern void test_rpath(void);
+extern void test_runpath(void);
+
+int main(void)
+{
+ test_rpath();
+ test_runpath();
+ return 0;
+}
diff --git a/Tests/RunCMake/install/file-GET_RUNTIME_DEPENDENCIES-linux/toplib.c b/Tests/RunCMake/install/file-GET_RUNTIME_DEPENDENCIES-linux/toplib.c
new file mode 100644
index 0000000..040e591
--- /dev/null
+++ b/Tests/RunCMake/install/file-GET_RUNTIME_DEPENDENCIES-linux/toplib.c
@@ -0,0 +1,8 @@
+extern void test_rpath(void);
+extern void test_runpath(void);
+
+void toplib(void)
+{
+ test_rpath();
+ test_runpath();
+}
diff --git a/Tests/RunCMake/install/file-GET_RUNTIME_DEPENDENCIES-macos-all-check.cmake b/Tests/RunCMake/install/file-GET_RUNTIME_DEPENDENCIES-macos-all-check.cmake
new file mode 100644
index 0000000..4d6dde1
--- /dev/null
+++ b/Tests/RunCMake/install/file-GET_RUNTIME_DEPENDENCIES-macos-all-check.cmake
@@ -0,0 +1,157 @@
+function(check_contents filename contents_regex)
+ if(EXISTS "${CMAKE_INSTALL_PREFIX}/${filename}")
+ file(READ "${CMAKE_INSTALL_PREFIX}/${filename}" contents)
+ if(NOT contents MATCHES "${contents_regex}")
+ string(APPEND RunCMake_TEST_FAILED "File contents:
+ ${contents}
+do not match what we expected:
+ ${contents_regex}
+in file:
+ ${CMAKE_INSTALL_PREFIX}/${filename}\n")
+ set(RunCMake_TEST_FAILED "${RunCMake_TEST_FAILED}" PARENT_SCOPE)
+ endif()
+ else()
+ string(APPEND RunCMake_TEST_FAILED "File ${CMAKE_INSTALL_PREFIX}/${filename} does not exist")
+ set(RunCMake_TEST_FAILED "${RunCMake_TEST_FAILED}" PARENT_SCOPE)
+ endif()
+endfunction()
+
+set(_check
+ [[[^;]*/Tests/RunCMake/install/file-GET_RUNTIME_DEPENDENCIES-macos-build/root-all/executable/bin/../lib/executable_path/libexecutable_path\.dylib]]
+ [[[^;]*/Tests/RunCMake/install/file-GET_RUNTIME_DEPENDENCIES-macos-build/root-all/executable/bin/../lib/rpath_executable_path/librpath_executable_path\.dylib]]
+ [[[^;]*/Tests/RunCMake/install/file-GET_RUNTIME_DEPENDENCIES-macos-build/root-all/executable/lib/libtestlib\.dylib]]
+ [[[^;]*/Tests/RunCMake/install/file-GET_RUNTIME_DEPENDENCIES-macos-build/root-all/executable/lib/loader_path/libloader_path\.dylib]]
+ [[[^;]*/Tests/RunCMake/install/file-GET_RUNTIME_DEPENDENCIES-macos-build/root-all/executable/lib/normal/../rpath/librpath\.dylib]]
+ [[[^;]*/Tests/RunCMake/install/file-GET_RUNTIME_DEPENDENCIES-macos-build/root-all/executable/lib/normal/libnormal\.dylib]]
+ [[[^;]*/Tests/RunCMake/install/file-GET_RUNTIME_DEPENDENCIES-macos-build/root-all/executable/lib/rpath_loader_path/librpath_loader_path\.dylib]]
+ [[/usr/lib/libSystem\.B\.dylib]]
+ )
+check_contents(deps/deps1.txt "^${_check}$")
+
+set(_check
+ [[@executable_path/../lib/executable_path_bundle/libexecutable_path_bundle\.dylib]]
+ [[@loader_path/loader_path_unresolved/libloader_path_unresolved\.dylib]]
+ [[@rpath/librpath_executable_path_bundle\.dylib]]
+ [[@rpath/librpath_loader_path_unresolved\.dylib]]
+ [[@rpath/librpath_unresolved\.dylib]]
+ )
+check_contents(deps/udeps1.txt "^${_check}$")
+
+set(_check
+ [[[^;]*/Tests/RunCMake/install/file-GET_RUNTIME_DEPENDENCIES-macos-build/root-all/executable/lib/libtestlib\.dylib]]
+ [[[^;]*/Tests/RunCMake/install/file-GET_RUNTIME_DEPENDENCIES-macos-build/root-all/executable/lib/loader_path/libloader_path\.dylib]]
+ [[[^;]*/Tests/RunCMake/install/file-GET_RUNTIME_DEPENDENCIES-macos-build/root-all/executable/lib/normal/../rpath/librpath\.dylib]]
+ [[[^;]*/Tests/RunCMake/install/file-GET_RUNTIME_DEPENDENCIES-macos-build/root-all/executable/lib/normal/libnormal\.dylib]]
+ [[[^;]*/Tests/RunCMake/install/file-GET_RUNTIME_DEPENDENCIES-macos-build/root-all/executable/lib/rpath_loader_path/librpath_loader_path\.dylib]]
+ [[/usr/lib/libSystem\.B\.dylib]]
+ )
+check_contents(deps/deps2.txt "^${_check}$")
+
+set(_check
+ [[@executable_path/../lib/executable_path/libexecutable_path\.dylib]]
+ [[@executable_path/../lib/executable_path_bundle/libexecutable_path_bundle\.dylib]]
+ [[@executable_path/../lib/executable_path_postexcluded/libexecutable_path_postexcluded\.dylib]]
+ [[@loader_path/loader_path_unresolved/libloader_path_unresolved\.dylib]]
+ [[@rpath/librpath_executable_path\.dylib]]
+ [[@rpath/librpath_executable_path_bundle\.dylib]]
+ [[@rpath/librpath_executable_path_postexcluded\.dylib]]
+ [[@rpath/librpath_loader_path_unresolved\.dylib]]
+ [[@rpath/librpath_unresolved\.dylib]]
+ )
+check_contents(deps/udeps2.txt "^${_check}$")
+
+set(_check
+ [[[^;]*/Tests/RunCMake/install/file-GET_RUNTIME_DEPENDENCIES-macos-build/root-all/executable/lib/libtestlib\.dylib]]
+ [[[^;]*/Tests/RunCMake/install/file-GET_RUNTIME_DEPENDENCIES-macos-build/root-all/executable/lib/loader_path/libloader_path\.dylib]]
+ [[[^;]*/Tests/RunCMake/install/file-GET_RUNTIME_DEPENDENCIES-macos-build/root-all/executable/lib/normal/../rpath/librpath\.dylib]]
+ [[[^;]*/Tests/RunCMake/install/file-GET_RUNTIME_DEPENDENCIES-macos-build/root-all/executable/lib/normal/libnormal\.dylib]]
+ [[[^;]*/Tests/RunCMake/install/file-GET_RUNTIME_DEPENDENCIES-macos-build/root-all/executable/lib/rpath_loader_path/librpath_loader_path\.dylib]]
+ [[/usr/lib/libSystem\.B\.dylib]]
+ )
+check_contents(deps/deps3.txt "^${_check}$")
+
+set(_check
+ [[@executable_path/../lib/executable_path/libexecutable_path\.dylib]]
+ [[@executable_path/../lib/executable_path_bundle/libexecutable_path_bundle\.dylib]]
+ [[@executable_path/../lib/executable_path_postexcluded/libexecutable_path_postexcluded\.dylib]]
+ [[@loader_path/loader_path_unresolved/libloader_path_unresolved\.dylib]]
+ [[@rpath/librpath_executable_path\.dylib]]
+ [[@rpath/librpath_executable_path_bundle\.dylib]]
+ [[@rpath/librpath_executable_path_postexcluded\.dylib]]
+ [[@rpath/librpath_loader_path_unresolved\.dylib]]
+ [[@rpath/librpath_unresolved\.dylib]]
+ )
+check_contents(deps/udeps3.txt "^${_check}$")
+
+set(_check
+ [[[^;]*/Tests/RunCMake/install/file-GET_RUNTIME_DEPENDENCIES-macos-build/root-all/executable/bin/../lib/executable_path/libexecutable_path\.dylib]]
+ [[[^;]*/Tests/RunCMake/install/file-GET_RUNTIME_DEPENDENCIES-macos-build/root-all/executable/bin/../lib/rpath_executable_path/librpath_executable_path\.dylib]]
+ [[[^;]*/Tests/RunCMake/install/file-GET_RUNTIME_DEPENDENCIES-macos-build/root-all/executable/lib/libtestlib\.dylib]]
+ [[[^;]*/Tests/RunCMake/install/file-GET_RUNTIME_DEPENDENCIES-macos-build/root-all/executable/lib/loader_path/libloader_path\.dylib]]
+ [[[^;]*/Tests/RunCMake/install/file-GET_RUNTIME_DEPENDENCIES-macos-build/root-all/executable/lib/normal/../rpath/librpath\.dylib]]
+ [[[^;]*/Tests/RunCMake/install/file-GET_RUNTIME_DEPENDENCIES-macos-build/root-all/executable/lib/normal/libnormal\.dylib]]
+ [[[^;]*/Tests/RunCMake/install/file-GET_RUNTIME_DEPENDENCIES-macos-build/root-all/executable/lib/rpath_loader_path/librpath_loader_path\.dylib]]
+ [[/usr/lib/libSystem\.B\.dylib]]
+ )
+check_contents(deps/deps4.txt "^${_check}$")
+
+set(_check
+ [[@executable_path/../lib/executable_path_bundle/libexecutable_path_bundle\.dylib]]
+ [[@loader_path/loader_path_unresolved/libloader_path_unresolved\.dylib]]
+ [[@rpath/librpath_executable_path_bundle\.dylib]]
+ [[@rpath/librpath_loader_path_unresolved\.dylib]]
+ [[@rpath/librpath_unresolved\.dylib]]
+ )
+check_contents(deps/udeps4.txt "^${_check}$")
+
+set(_check
+ [[[^;]*/Tests/RunCMake/install/file-GET_RUNTIME_DEPENDENCIES-macos-build/root-all/bundle_executable/bin/../lib/executable_path_bundle/libexecutable_path_bundle\.dylib]]
+ [[[^;]*/Tests/RunCMake/install/file-GET_RUNTIME_DEPENDENCIES-macos-build/root-all/executable/lib/libtestlib\.dylib]]
+ [[[^;]*/Tests/RunCMake/install/file-GET_RUNTIME_DEPENDENCIES-macos-build/root-all/executable/lib/loader_path/libloader_path\.dylib]]
+ [[[^;]*/Tests/RunCMake/install/file-GET_RUNTIME_DEPENDENCIES-macos-build/root-all/executable/lib/normal/../rpath/librpath\.dylib]]
+ [[[^;]*/Tests/RunCMake/install/file-GET_RUNTIME_DEPENDENCIES-macos-build/root-all/executable/lib/normal/libnormal\.dylib]]
+ [[[^;]*/Tests/RunCMake/install/file-GET_RUNTIME_DEPENDENCIES-macos-build/root-all/executable/lib/rpath_loader_path/librpath_loader_path\.dylib]]
+ [[/usr/lib/libSystem\.B\.dylib]]
+ )
+check_contents(deps/deps5.txt "^${_check}$")
+
+set(_check
+ [[@executable_path/../lib/executable_path/libexecutable_path\.dylib]]
+ [[@loader_path/loader_path_unresolved/libloader_path_unresolved\.dylib]]
+ [[@rpath/librpath_executable_path\.dylib]]
+ [[@rpath/librpath_executable_path_bundle\.dylib]]
+ [[@rpath/librpath_loader_path_unresolved\.dylib]]
+ [[@rpath/librpath_unresolved\.dylib]]
+ )
+check_contents(deps/udeps5.txt "^${_check}$")
+
+set(_check
+ [[[^;]*/Tests/RunCMake/install/file-GET_RUNTIME_DEPENDENCIES-macos-build/root-all/bundle_executable/bin/../lib/executable_path_bundle/libexecutable_path_bundle\.dylib]]
+ [[[^;]*/Tests/RunCMake/install/file-GET_RUNTIME_DEPENDENCIES-macos-build/root-all/executable/lib/libtestlib\.dylib]]
+ [[[^;]*/Tests/RunCMake/install/file-GET_RUNTIME_DEPENDENCIES-macos-build/root-all/executable/lib/loader_path/libloader_path\.dylib]]
+ [[[^;]*/Tests/RunCMake/install/file-GET_RUNTIME_DEPENDENCIES-macos-build/root-all/executable/lib/normal/../rpath/librpath\.dylib]]
+ [[[^;]*/Tests/RunCMake/install/file-GET_RUNTIME_DEPENDENCIES-macos-build/root-all/executable/lib/normal/libnormal\.dylib]]
+ [[[^;]*/Tests/RunCMake/install/file-GET_RUNTIME_DEPENDENCIES-macos-build/root-all/executable/lib/rpath_loader_path/librpath_loader_path\.dylib]]
+ [[/usr/lib/libSystem\.B\.dylib]]
+ )
+check_contents(deps/deps6.txt "^${_check}$")
+
+set(_check
+ [[@executable_path/../lib/executable_path/libexecutable_path\.dylib]]
+ [[@loader_path/loader_path_unresolved/libloader_path_unresolved\.dylib]]
+ [[@rpath/librpath_executable_path\.dylib]]
+ [[@rpath/librpath_executable_path_bundle\.dylib]]
+ [[@rpath/librpath_loader_path_unresolved\.dylib]]
+ [[@rpath/librpath_unresolved\.dylib]]
+ )
+check_contents(deps/udeps6.txt "^${_check}$")
+
+set(_check
+ "^libconflict\\.dylib:[^;]*/Tests/RunCMake/install/file-GET_RUNTIME_DEPENDENCIES-macos-build/root-all/executable/lib/conflict/libconflict\\.dylib;[^;]*/Tests/RunCMake/install/file-GET_RUNTIME_DEPENDENCIES-macos-build/root-all/executable/lib/conflict2/libconflict\\.dylib\n$"
+ )
+check_contents(deps/cdeps1.txt "${_check}")
+check_contents(deps/cdeps2.txt "${_check}")
+check_contents(deps/cdeps3.txt "${_check}")
+check_contents(deps/cdeps4.txt "${_check}")
+check_contents(deps/cdeps5.txt "${_check}")
+check_contents(deps/cdeps6.txt "${_check}")
diff --git a/Tests/RunCMake/install/file-GET_RUNTIME_DEPENDENCIES-macos-conflict-all-result.txt b/Tests/RunCMake/install/file-GET_RUNTIME_DEPENDENCIES-macos-conflict-all-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/install/file-GET_RUNTIME_DEPENDENCIES-macos-conflict-all-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/install/file-GET_RUNTIME_DEPENDENCIES-macos-conflict-all-stderr.txt b/Tests/RunCMake/install/file-GET_RUNTIME_DEPENDENCIES-macos-conflict-all-stderr.txt
new file mode 100644
index 0000000..bc9e97a
--- /dev/null
+++ b/Tests/RunCMake/install/file-GET_RUNTIME_DEPENDENCIES-macos-conflict-all-stderr.txt
@@ -0,0 +1,7 @@
+^CMake Error at cmake_install\.cmake:[0-9]+ \(file\):
+ file Multiple conflicting paths found for librpath\.dylib:
+
+ [^
+]*/Tests/RunCMake/install/file-GET_RUNTIME_DEPENDENCIES-macos-conflict-build/root-all/lib/rpath1/librpath\.dylib
+ [^
+]*/Tests/RunCMake/install/file-GET_RUNTIME_DEPENDENCIES-macos-conflict-build/root-all/lib/rpath2/librpath\.dylib$
diff --git a/Tests/RunCMake/install/file-GET_RUNTIME_DEPENDENCIES-macos-conflict.cmake b/Tests/RunCMake/install/file-GET_RUNTIME_DEPENDENCIES-macos-conflict.cmake
new file mode 100644
index 0000000..a8446fe
--- /dev/null
+++ b/Tests/RunCMake/install/file-GET_RUNTIME_DEPENDENCIES-macos-conflict.cmake
@@ -0,0 +1,55 @@
+enable_language(C)
+
+set(test1_names rpath)
+set(test2_names rpath)
+
+file(WRITE "${CMAKE_BINARY_DIR}/rpath.c" "void rpath(void) {}\n")
+add_library(rpath SHARED "${CMAKE_BINARY_DIR}/rpath.c")
+set_property(TARGET rpath PROPERTY INSTALL_NAME_DIR @rpath)
+install(TARGETS rpath DESTINATION lib/rpath1)
+install(TARGETS rpath DESTINATION lib/rpath2)
+
+file(REMOVE "${CMAKE_BINARY_DIR}/test1.c")
+add_library(test1 SHARED "${CMAKE_BINARY_DIR}/test1.c")
+foreach(name ${test1_names})
+ file(APPEND "${CMAKE_BINARY_DIR}/test1.c" "extern void ${name}(void);\n")
+endforeach()
+file(APPEND "${CMAKE_BINARY_DIR}/test1.c" "void test1(void)\n{\n")
+foreach(name ${test1_names})
+ file(APPEND "${CMAKE_BINARY_DIR}/test1.c" " ${name}();\n")
+endforeach()
+file(APPEND "${CMAKE_BINARY_DIR}/test1.c" "}\n")
+
+target_link_libraries(test1 PRIVATE ${test1_names})
+set_property(TARGET test1 PROPERTY INSTALL_RPATH
+ "${CMAKE_BINARY_DIR}/root-all/lib/rpath1"
+ )
+
+file(REMOVE "${CMAKE_BINARY_DIR}/test2.c")
+add_library(test2 SHARED "${CMAKE_BINARY_DIR}/test2.c")
+foreach(name ${test2_names})
+ file(APPEND "${CMAKE_BINARY_DIR}/test2.c" "extern void ${name}(void);\n")
+endforeach()
+file(APPEND "${CMAKE_BINARY_DIR}/test2.c" "void test2(void)\n{\n")
+foreach(name ${test2_names})
+ file(APPEND "${CMAKE_BINARY_DIR}/test2.c" " ${name}();\n")
+endforeach()
+file(APPEND "${CMAKE_BINARY_DIR}/test2.c" "}\n")
+
+target_link_libraries(test2 PRIVATE ${test2_names})
+set_property(TARGET test2 PROPERTY INSTALL_RPATH
+ "${CMAKE_BINARY_DIR}/root-all/lib/rpath2"
+ )
+
+install(TARGETS test1 test2 DESTINATION lib)
+
+install(CODE [[
+ file(GET_RUNTIME_DEPENDENCIES
+ LIBRARIES
+ "${CMAKE_INSTALL_PREFIX}/lib/$<TARGET_FILE_NAME:test1>"
+ "${CMAKE_INSTALL_PREFIX}/lib/$<TARGET_FILE_NAME:test2>"
+ PRE_INCLUDE_REGEXES "^@rpath/librpath\\.dylib$"
+ PRE_EXCLUDE_REGEXES ".*"
+ )
+ message(FATAL_ERROR "This message should not be displayed")
+ ]])
diff --git a/Tests/RunCMake/install/file-GET_RUNTIME_DEPENDENCIES-macos-notfile-all-result.txt b/Tests/RunCMake/install/file-GET_RUNTIME_DEPENDENCIES-macos-notfile-all-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/install/file-GET_RUNTIME_DEPENDENCIES-macos-notfile-all-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/install/file-GET_RUNTIME_DEPENDENCIES-macos-notfile-all-stderr.txt b/Tests/RunCMake/install/file-GET_RUNTIME_DEPENDENCIES-macos-notfile-all-stderr.txt
new file mode 100644
index 0000000..73ab9f1
--- /dev/null
+++ b/Tests/RunCMake/install/file-GET_RUNTIME_DEPENDENCIES-macos-notfile-all-stderr.txt
@@ -0,0 +1,5 @@
+^CMake Error at cmake_install\.cmake:[0-9]+ \(file\):
+ file Failed to run otool on:
+
+ [^
+]*/Tests/RunCMake/install/file-GET_RUNTIME_DEPENDENCIES-macos-notfile-build/root-all/bin/\.\./lib/libtest\.dylib$
diff --git a/Tests/RunCMake/install/file-GET_RUNTIME_DEPENDENCIES-macos-notfile.cmake b/Tests/RunCMake/install/file-GET_RUNTIME_DEPENDENCIES-macos-notfile.cmake
new file mode 100644
index 0000000..3e4c434
--- /dev/null
+++ b/Tests/RunCMake/install/file-GET_RUNTIME_DEPENDENCIES-macos-notfile.cmake
@@ -0,0 +1,30 @@
+enable_language(C)
+
+file(WRITE "${CMAKE_BINARY_DIR}/test.c" "void test(void) {}\n")
+file(WRITE "${CMAKE_BINARY_DIR}/main.c" [[extern void test(void);
+
+int main(void)
+{
+ test();
+ return 0;
+}
+]])
+
+add_library(test SHARED "${CMAKE_BINARY_DIR}/test.c")
+set_property(TARGET test PROPERTY INSTALL_NAME_DIR @rpath)
+add_executable(exe "${CMAKE_BINARY_DIR}/main.c")
+target_link_libraries(exe PRIVATE test)
+set_property(TARGET exe PROPERTY INSTALL_RPATH "@loader_path/../lib")
+
+install(TARGETS exe DESTINATION bin)
+
+install(CODE [[
+ file(MAKE_DIRECTORY "${CMAKE_INSTALL_PREFIX}/lib/$<TARGET_FILE_NAME:test>")
+ file(GET_RUNTIME_DEPENDENCIES
+ EXECUTABLES
+ "${CMAKE_INSTALL_PREFIX}/bin/$<TARGET_FILE_NAME:exe>"
+ PRE_INCLUDE_REGEXES "^@rpath/libtest\\.dylib$"
+ PRE_EXCLUDE_REGEXES ".*"
+ )
+ message(FATAL_ERROR "This message should not be displayed")
+ ]])
diff --git a/Tests/RunCMake/install/file-GET_RUNTIME_DEPENDENCIES-macos-unresolved-all-result.txt b/Tests/RunCMake/install/file-GET_RUNTIME_DEPENDENCIES-macos-unresolved-all-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/install/file-GET_RUNTIME_DEPENDENCIES-macos-unresolved-all-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/install/file-GET_RUNTIME_DEPENDENCIES-macos-unresolved-all-stderr.txt b/Tests/RunCMake/install/file-GET_RUNTIME_DEPENDENCIES-macos-unresolved-all-stderr.txt
new file mode 100644
index 0000000..01762b4
--- /dev/null
+++ b/Tests/RunCMake/install/file-GET_RUNTIME_DEPENDENCIES-macos-unresolved-all-stderr.txt
@@ -0,0 +1,2 @@
+^CMake Error at cmake_install\.cmake:[0-9]+ \(file\):
+ file Could not resolve file @rpath/libunresolved\.dylib$
diff --git a/Tests/RunCMake/install/file-GET_RUNTIME_DEPENDENCIES-macos-unresolved.cmake b/Tests/RunCMake/install/file-GET_RUNTIME_DEPENDENCIES-macos-unresolved.cmake
new file mode 100644
index 0000000..c9b6c95
--- /dev/null
+++ b/Tests/RunCMake/install/file-GET_RUNTIME_DEPENDENCIES-macos-unresolved.cmake
@@ -0,0 +1,18 @@
+enable_language(C)
+
+file(WRITE "${CMAKE_BINARY_DIR}/testlib.c" "extern void unresolved(void);\nvoid testlib(void)\n{\n unresolved();\n}\n")
+add_library(testlib SHARED "${CMAKE_BINARY_DIR}/testlib.c")
+file(WRITE "${CMAKE_BINARY_DIR}/unresolved.c" "void unresolved(void) {}\n")
+add_library(unresolved SHARED "${CMAKE_BINARY_DIR}/unresolved.c")
+target_link_libraries(testlib PRIVATE unresolved)
+install(TARGETS testlib DESTINATION lib)
+
+install(CODE [[
+ file(GET_RUNTIME_DEPENDENCIES
+ PRE_INCLUDE_REGEXES "^@rpath/libunresolved\\.dylib$"
+ PRE_EXCLUDE_REGEXES ".*"
+ LIBRARIES
+ "${CMAKE_INSTALL_PREFIX}/lib/$<TARGET_FILE_NAME:testlib>"
+ )
+ message(FATAL_ERROR "This message should not be displayed")
+ ]])
diff --git a/Tests/RunCMake/install/file-GET_RUNTIME_DEPENDENCIES-macos.cmake b/Tests/RunCMake/install/file-GET_RUNTIME_DEPENDENCIES-macos.cmake
new file mode 100644
index 0000000..6db05b3
--- /dev/null
+++ b/Tests/RunCMake/install/file-GET_RUNTIME_DEPENDENCIES-macos.cmake
@@ -0,0 +1,216 @@
+enable_language(C)
+
+set(testlib_names
+ preexcluded
+ executable_path
+ executable_path_bundle
+ executable_path_postexcluded
+ loader_path
+ loader_path_unresolved
+ loader_path_postexcluded
+ rpath
+ rpath_unresolved
+ rpath_postexcluded
+ rpath_executable_path
+ rpath_executable_path_bundle
+ rpath_executable_path_postexcluded
+ rpath_loader_path
+ rpath_loader_path_unresolved
+ rpath_loader_path_postexcluded
+ normal
+ normal_unresolved
+ normal_postexcluded
+ conflict
+ )
+
+file(REMOVE "${CMAKE_BINARY_DIR}/testlib.c")
+add_library(testlib SHARED "${CMAKE_BINARY_DIR}/testlib.c")
+foreach(name ${testlib_names})
+ if(name STREQUAL "normal")
+ file(WRITE "${CMAKE_BINARY_DIR}/normal.c" "extern void rpath(void);\nvoid normal(void)\n{\n rpath();\n}\n")
+ else()
+ file(WRITE "${CMAKE_BINARY_DIR}/${name}.c" "void ${name}(void) {}\n")
+ endif()
+ add_library(${name} SHARED "${CMAKE_BINARY_DIR}/${name}.c")
+
+ file(APPEND "${CMAKE_BINARY_DIR}/testlib.c" "extern void ${name}(void);\n")
+endforeach()
+file(APPEND "${CMAKE_BINARY_DIR}/testlib.c" "void testlib(void)\n{\n")
+foreach(name ${testlib_names})
+ file(APPEND "${CMAKE_BINARY_DIR}/testlib.c" " ${name}();\n")
+endforeach()
+file(APPEND "${CMAKE_BINARY_DIR}/testlib.c" "}\n")
+set_property(TARGET ${testlib_names} PROPERTY BUILD_WITH_INSTALL_NAME_DIR 1)
+target_link_libraries(normal PRIVATE rpath)
+set_property(TARGET normal PROPERTY INSTALL_RPATH
+ "${CMAKE_BINARY_DIR}/root-all/executable/lib/normal/../rpath"
+ )
+
+file(WRITE "${CMAKE_BINARY_DIR}/testlib_conflict.c" "extern void conflict(void);\nvoid testlib_conflict(void)\n{\n conflict();\n}\n")
+add_library(testlib_conflict SHARED "${CMAKE_BINARY_DIR}/testlib_conflict.c")
+target_link_libraries(testlib_conflict PRIVATE conflict)
+
+set_property(TARGET testlib PROPERTY INSTALL_RPATH
+ "${CMAKE_BINARY_DIR}/root-all/executable/lib/rpath"
+ "${CMAKE_BINARY_DIR}/root-all/executable/lib/rpath_unresolved"
+ "${CMAKE_BINARY_DIR}/root-all/executable/lib/rpath_postexcluded"
+ "${CMAKE_BINARY_DIR}/root-all/executable/lib/conflict"
+ @executable_path/../lib/rpath_executable_path
+ @executable_path/../lib/rpath_executable_path_unresolved
+ @executable_path/../lib/rpath_executable_path_postexcluded
+ @loader_path/rpath_loader_path
+ @loader_path/rpath_loader_path_unresolved
+ @loader_path/rpath_loader_path_postexcluded
+ )
+set_property(TARGET testlib_conflict PROPERTY INSTALL_RPATH
+ "${CMAKE_BINARY_DIR}/root-all/executable/lib/conflict2"
+ )
+
+foreach(t
+ executable_path
+ executable_path_postexcluded
+ loader_path
+ loader_path_postexcluded
+ rpath
+ rpath_postexcluded
+ rpath_executable_path
+ rpath_executable_path_postexcluded
+ rpath_loader_path
+ rpath_loader_path_postexcluded
+ conflict
+ )
+ install(TARGETS ${t} DESTINATION executable/lib/${t})
+endforeach()
+install(TARGETS conflict DESTINATION executable/lib/conflict2)
+
+foreach(t
+ executable_path_bundle
+ executable_path_postexcluded
+ loader_path_postexcluded
+ rpath_postexcluded
+ rpath_executable_path_bundle
+ rpath_executable_path_postexcluded
+ rpath_loader_path_postexcluded
+ )
+ install(TARGETS ${t} DESTINATION bundle_executable/lib/${t})
+endforeach()
+
+foreach(t executable_path executable_path_bundle executable_path_postexcluded)
+ set_property(TARGET ${t} PROPERTY INSTALL_NAME_DIR @executable_path/../lib/${t})
+endforeach()
+
+foreach(t loader_path loader_path_unresolved loader_path_postexcluded)
+ set_property(TARGET ${t} PROPERTY INSTALL_NAME_DIR @loader_path/${t})
+endforeach()
+
+foreach(t
+ rpath
+ rpath_unresolved
+ rpath_postexcluded
+ rpath_executable_path
+ rpath_executable_path_bundle
+ rpath_executable_path_postexcluded
+ rpath_loader_path
+ rpath_loader_path_unresolved
+ rpath_loader_path_postexcluded
+ conflict
+ )
+ set_property(TARGET ${t} PROPERTY INSTALL_NAME_DIR @rpath)
+endforeach()
+
+foreach(t normal normal_unresolved normal_postexcluded)
+ set_property(TARGET ${t} PROPERTY INSTALL_NAME_DIR "${CMAKE_BINARY_DIR}/root-all/executable/lib/${t}")
+ if(NOT t STREQUAL "normal_unresolved")
+ install(TARGETS ${t} DESTINATION executable/lib/${t})
+ endif()
+endforeach()
+
+target_link_libraries(testlib PRIVATE ${testlib_names})
+
+add_executable(topexe file-GET_RUNTIME_DEPENDENCIES-macos/topexe.c)
+add_library(toplib SHARED file-GET_RUNTIME_DEPENDENCIES-macos/toplib.c)
+add_library(topmod MODULE file-GET_RUNTIME_DEPENDENCIES-macos/toplib.c)
+target_link_libraries(topexe PRIVATE testlib)
+target_link_libraries(toplib PRIVATE testlib)
+target_link_libraries(topmod PRIVATE testlib)
+
+set_property(TARGET topexe toplib topmod PROPERTY INSTALL_RPATH "${CMAKE_BINARY_DIR}/root-all/executable/lib")
+
+install(TARGETS topexe toplib topmod testlib testlib_conflict RUNTIME DESTINATION executable/bin LIBRARY DESTINATION executable/lib)
+install(TARGETS topexe toplib topmod testlib testlib_conflict RUNTIME DESTINATION bundle_executable/bin LIBRARY DESTINATION bundle_executable/lib)
+
+install(CODE [[
+ function(exec_get_runtime_dependencies depsfile udepsfile cdepsfile)
+ file(GET_RUNTIME_DEPENDENCIES
+ RESOLVED_DEPENDENCIES_VAR deps
+ UNRESOLVED_DEPENDENCIES_VAR udeps
+ CONFLICTING_DEPENDENCIES_PREFIX cdeps
+ PRE_INCLUDE_REGEXES "^.*/lib(testlib|executable_path|executable_path_bundle|executable_path_postexcluded|loader_path|loader_path_unresolved|loader_path_postexcluded|rpath|rpath_unresolved|rpath_postexcluded|rpath_executable_path|rpath_executable_path_bundle|rpath_executable_path_postexcluded|rpath_loader_path|rpath_loader_path_unresolved|rpath_loader_path_postexcluded|normal|normal_unresolved|normal_postexcluded|conflict|System\\.B)\\.dylib$"
+ PRE_EXCLUDE_REGEXES ".*"
+ POST_INCLUDE_REGEXES "^.*/lib(testlib|executable_path|executable_path_bundle|loader_path|rpath|rpath_executable_path|rpath_executable_path_bundle|rpath_loader_path|normal|conflict|System\\.B)\\.dylib$"
+ POST_EXCLUDE_REGEXES ".*"
+ ${ARGN}
+ )
+ list(SORT deps)
+ list(SORT udeps)
+ list(SORT cdeps_FILENAMES)
+ file(WRITE "${CMAKE_INSTALL_PREFIX}/deps/${depsfile}" "${deps}")
+ file(WRITE "${CMAKE_INSTALL_PREFIX}/deps/${udepsfile}" "${udeps}")
+ file(WRITE "${CMAKE_INSTALL_PREFIX}/deps/${cdepsfile}" "")
+ foreach(cdep IN LISTS cdeps_FILENAMES)
+ set(cdep_values ${cdeps_${cdep}})
+ list(SORT cdep_values)
+ file(APPEND "${CMAKE_INSTALL_PREFIX}/deps/${cdepsfile}" "${cdep}:${cdep_values}\n")
+ endforeach()
+ endfunction()
+
+ exec_get_runtime_dependencies(
+ deps1.txt udeps1.txt cdeps1.txt
+ EXECUTABLES
+ "${CMAKE_INSTALL_PREFIX}/executable/bin/$<TARGET_FILE_NAME:topexe>"
+ LIBRARIES
+ "${CMAKE_INSTALL_PREFIX}/executable/lib/$<TARGET_FILE_NAME:testlib_conflict>"
+ )
+
+ exec_get_runtime_dependencies(
+ deps2.txt udeps2.txt cdeps2.txt
+ LIBRARIES
+ "${CMAKE_INSTALL_PREFIX}/executable/lib/$<TARGET_FILE_NAME:toplib>"
+ "${CMAKE_INSTALL_PREFIX}/executable/lib/$<TARGET_FILE_NAME:testlib_conflict>"
+ )
+
+ exec_get_runtime_dependencies(
+ deps3.txt udeps3.txt cdeps3.txt
+ MODULES
+ "${CMAKE_INSTALL_PREFIX}/executable/lib/$<TARGET_FILE_NAME:topmod>"
+ LIBRARIES
+ "${CMAKE_INSTALL_PREFIX}/executable/lib/$<TARGET_FILE_NAME:testlib_conflict>"
+ )
+
+ exec_get_runtime_dependencies(
+ deps4.txt udeps4.txt cdeps4.txt
+ EXECUTABLES
+ "${CMAKE_INSTALL_PREFIX}/executable/bin/$<TARGET_FILE_NAME:topexe>"
+ LIBRARIES
+ "${CMAKE_INSTALL_PREFIX}/executable/lib/$<TARGET_FILE_NAME:testlib_conflict>"
+ BUNDLE_EXECUTABLE
+ "${CMAKE_INSTALL_PREFIX}/bundle_executable/bin/$<TARGET_FILE_NAME:topexe>"
+ )
+
+ exec_get_runtime_dependencies(
+ deps5.txt udeps5.txt cdeps5.txt
+ LIBRARIES
+ "${CMAKE_INSTALL_PREFIX}/executable/lib/$<TARGET_FILE_NAME:toplib>"
+ "${CMAKE_INSTALL_PREFIX}/executable/lib/$<TARGET_FILE_NAME:testlib_conflict>"
+ BUNDLE_EXECUTABLE "${CMAKE_INSTALL_PREFIX}/bundle_executable/bin/$<TARGET_FILE_NAME:topexe>"
+ )
+
+ exec_get_runtime_dependencies(
+ deps6.txt udeps6.txt cdeps6.txt
+ MODULES
+ "${CMAKE_INSTALL_PREFIX}/executable/lib/$<TARGET_FILE_NAME:topmod>"
+ LIBRARIES
+ "${CMAKE_INSTALL_PREFIX}/executable/lib/$<TARGET_FILE_NAME:testlib_conflict>"
+ BUNDLE_EXECUTABLE "${CMAKE_INSTALL_PREFIX}/bundle_executable/bin/$<TARGET_FILE_NAME:topexe>"
+ )
+ ]])
diff --git a/Tests/RunCMake/install/file-GET_RUNTIME_DEPENDENCIES-macos/topexe.c b/Tests/RunCMake/install/file-GET_RUNTIME_DEPENDENCIES-macos/topexe.c
new file mode 100644
index 0000000..20c6087
--- /dev/null
+++ b/Tests/RunCMake/install/file-GET_RUNTIME_DEPENDENCIES-macos/topexe.c
@@ -0,0 +1,7 @@
+extern void testlib(void);
+
+int main(void)
+{
+ testlib();
+ return 0;
+}
diff --git a/Tests/RunCMake/install/file-GET_RUNTIME_DEPENDENCIES-macos/toplib.c b/Tests/RunCMake/install/file-GET_RUNTIME_DEPENDENCIES-macos/toplib.c
new file mode 100644
index 0000000..cff1bff
--- /dev/null
+++ b/Tests/RunCMake/install/file-GET_RUNTIME_DEPENDENCIES-macos/toplib.c
@@ -0,0 +1,6 @@
+extern void testlib(void);
+
+void toplib(void)
+{
+ testlib();
+}
diff --git a/Tests/RunCMake/install/file-GET_RUNTIME_DEPENDENCIES-project-stderr.txt b/Tests/RunCMake/install/file-GET_RUNTIME_DEPENDENCIES-project-stderr.txt
new file mode 100644
index 0000000..d506645
--- /dev/null
+++ b/Tests/RunCMake/install/file-GET_RUNTIME_DEPENDENCIES-project-stderr.txt
@@ -0,0 +1,13 @@
+^CMake Warning \(dev\) at file-GET_RUNTIME_DEPENDENCIES-project\.cmake:[0-9]+ \(file\):
+ You have used file\(GET_RUNTIME_DEPENDENCIES\) in project mode\. This is
+ probably not what you intended to do\. Instead, please consider using it in
+ an install\(CODE\) or install\(SCRIPT\) command\. For example:
+
+ install\(CODE \[\[
+ file\(GET_RUNTIME_DEPENDENCIES
+ # \.\.\.
+ \)
+ ]]\)
+Call Stack \(most recent call first\):
+ CMakeLists\.txt:[0-9]+ \(include\)
+This warning is for project developers\. Use -Wno-dev to suppress it\.$
diff --git a/Tests/RunCMake/install/file-GET_RUNTIME_DEPENDENCIES-project.cmake b/Tests/RunCMake/install/file-GET_RUNTIME_DEPENDENCIES-project.cmake
new file mode 100644
index 0000000..842d7ab
--- /dev/null
+++ b/Tests/RunCMake/install/file-GET_RUNTIME_DEPENDENCIES-project.cmake
@@ -0,0 +1 @@
+file(GET_RUNTIME_DEPENDENCIES RESOLVED_DEPENDENCIES_VAR deps)
diff --git a/Tests/RunCMake/install/file-GET_RUNTIME_DEPENDENCIES-unsupported-result.txt b/Tests/RunCMake/install/file-GET_RUNTIME_DEPENDENCIES-unsupported-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/install/file-GET_RUNTIME_DEPENDENCIES-unsupported-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/install/file-GET_RUNTIME_DEPENDENCIES-unsupported-stderr.txt b/Tests/RunCMake/install/file-GET_RUNTIME_DEPENDENCIES-unsupported-stderr.txt
new file mode 100644
index 0000000..3db835c
--- /dev/null
+++ b/Tests/RunCMake/install/file-GET_RUNTIME_DEPENDENCIES-unsupported-stderr.txt
@@ -0,0 +1,5 @@
+^CMake Error at file-GET_RUNTIME_DEPENDENCIES-unsupported\.cmake:[0-9]+ \(file\):
+ file GET_RUNTIME_DEPENDENCIES is not supported on system "[^
+ ]+"
+Call Stack \(most recent call first\):
+ CMakeLists\.txt:[0-9]+ \(include\)$
diff --git a/Tests/RunCMake/install/file-GET_RUNTIME_DEPENDENCIES-unsupported.cmake b/Tests/RunCMake/install/file-GET_RUNTIME_DEPENDENCIES-unsupported.cmake
new file mode 100644
index 0000000..b91eefe
--- /dev/null
+++ b/Tests/RunCMake/install/file-GET_RUNTIME_DEPENDENCIES-unsupported.cmake
@@ -0,0 +1,2 @@
+file(GET_RUNTIME_DEPENDENCIES RESOLVED_DEPENDENCIES_VAR deps)
+message(FATAL_ERROR "This message should not be displayed")
diff --git a/Tests/RunCMake/install/file-GET_RUNTIME_DEPENDENCIES-windows-all-check.cmake b/Tests/RunCMake/install/file-GET_RUNTIME_DEPENDENCIES-windows-all-check.cmake
new file mode 100644
index 0000000..c120ce4
--- /dev/null
+++ b/Tests/RunCMake/install/file-GET_RUNTIME_DEPENDENCIES-windows-all-check.cmake
@@ -0,0 +1,38 @@
+function(check_contents filename contents_regex)
+ if(EXISTS "${CMAKE_INSTALL_PREFIX}/${filename}")
+ file(READ "${CMAKE_INSTALL_PREFIX}/${filename}" contents)
+ if(NOT contents MATCHES "${contents_regex}")
+ string(APPEND RunCMake_TEST_FAILED "File contents:
+ ${contents}
+do not match what we expected:
+ ${contents_regex}
+in file:
+ ${CMAKE_INSTALL_PREFIX}/${filename}\n")
+ set(RunCMake_TEST_FAILED "${RunCMake_TEST_FAILED}" PARENT_SCOPE)
+ endif()
+ else()
+ string(APPEND RunCMake_TEST_FAILED "File ${CMAKE_INSTALL_PREFIX}/${filename} does not exist")
+ set(RunCMake_TEST_FAILED "${RunCMake_TEST_FAILED}" PARENT_SCOPE)
+ endif()
+endfunction()
+
+set(_check
+ [=[[^;]*/Tests/RunCMake/install/file-GET_RUNTIME_DEPENDENCIES-windows-build/root-all/bin/\.conflict/\.\./(lib)?libdir\.dll]=]
+ [=[[^;]*/Tests/RunCMake/install/file-GET_RUNTIME_DEPENDENCIES-windows-build/root-all/bin/\.search/(lib)?search\.dll]=]
+ [=[[^;]*/Tests/RunCMake/install/file-GET_RUNTIME_DEPENDENCIES-windows-build/root-all/bin/(lib)?testlib\.dll]=]
+ )
+check_contents(deps/deps1.txt "^${_check}$")
+check_contents(deps/deps2.txt "^${_check}$")
+check_contents(deps/deps3.txt "^${_check}$")
+set(_check
+ [=[(lib)?unresolved\.dll]=]
+ )
+check_contents(deps/udeps1.txt "^${_check}$")
+check_contents(deps/udeps2.txt "^${_check}$")
+check_contents(deps/udeps3.txt "^${_check}$")
+set(_check
+ "^(lib)?conflict\\.dll:[^;]*/Tests/RunCMake/install/file-GET_RUNTIME_DEPENDENCIES-windows-build/root-all/bin/\\.conflict/(lib)?conflict\\.dll;[^;]*/Tests/RunCMake/install/file-GET_RUNTIME_DEPENDENCIES-windows-build/root-all/bin/(lib)?conflict\\.dll\n$"
+ )
+check_contents(deps/cdeps1.txt "${_check}")
+check_contents(deps/cdeps2.txt "${_check}")
+check_contents(deps/cdeps3.txt "${_check}")
diff --git a/Tests/RunCMake/install/file-GET_RUNTIME_DEPENDENCIES-windows-conflict-all-result.txt b/Tests/RunCMake/install/file-GET_RUNTIME_DEPENDENCIES-windows-conflict-all-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/install/file-GET_RUNTIME_DEPENDENCIES-windows-conflict-all-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/install/file-GET_RUNTIME_DEPENDENCIES-windows-conflict-all-stderr.txt b/Tests/RunCMake/install/file-GET_RUNTIME_DEPENDENCIES-windows-conflict-all-stderr.txt
new file mode 100644
index 0000000..66ecb93
--- /dev/null
+++ b/Tests/RunCMake/install/file-GET_RUNTIME_DEPENDENCIES-windows-conflict-all-stderr.txt
@@ -0,0 +1,7 @@
+^CMake Error at cmake_install\.cmake:[0-9]+ \(file\):
+ file Multiple conflicting paths found for (lib)?path\.dll:
+
+ [^
+]*/Tests/RunCMake/install/file-GET_RUNTIME_DEPENDENCIES-windows-conflict-build/root-all/lib/test1/(lib)?path\.dll
+ [^
+]*/Tests/RunCMake/install/file-GET_RUNTIME_DEPENDENCIES-windows-conflict-build/root-all/lib/test2/(lib)?path\.dll$
diff --git a/Tests/RunCMake/install/file-GET_RUNTIME_DEPENDENCIES-windows-conflict.cmake b/Tests/RunCMake/install/file-GET_RUNTIME_DEPENDENCIES-windows-conflict.cmake
new file mode 100644
index 0000000..d413443
--- /dev/null
+++ b/Tests/RunCMake/install/file-GET_RUNTIME_DEPENDENCIES-windows-conflict.cmake
@@ -0,0 +1,47 @@
+enable_language(C)
+
+set(test1_names path)
+set(test2_names path)
+
+file(WRITE "${CMAKE_BINARY_DIR}/path.c" "__declspec(dllexport) void path(void) {}\n")
+add_library(path SHARED "${CMAKE_BINARY_DIR}/path.c")
+
+file(REMOVE "${CMAKE_BINARY_DIR}/test1.c")
+add_library(test1 SHARED "${CMAKE_BINARY_DIR}/test1.c")
+foreach(name ${test1_names})
+ file(APPEND "${CMAKE_BINARY_DIR}/test1.c" "__declspec(dllimport) extern void ${name}(void);\n")
+endforeach()
+file(APPEND "${CMAKE_BINARY_DIR}/test1.c" "__declspec(dllexport) void test1(void)\n{\n")
+foreach(name ${test1_names})
+ file(APPEND "${CMAKE_BINARY_DIR}/test1.c" " ${name}();\n")
+endforeach()
+file(APPEND "${CMAKE_BINARY_DIR}/test1.c" "}\n")
+
+target_link_libraries(test1 PRIVATE ${test1_names})
+
+file(REMOVE "${CMAKE_BINARY_DIR}/test2.c")
+add_library(test2 SHARED "${CMAKE_BINARY_DIR}/test2.c")
+foreach(name ${test2_names})
+ file(APPEND "${CMAKE_BINARY_DIR}/test2.c" "__declspec(dllimport) extern void ${name}(void);\n")
+endforeach()
+file(APPEND "${CMAKE_BINARY_DIR}/test2.c" "__declspec(dllexport) void test2(void)\n{\n")
+foreach(name ${test2_names})
+ file(APPEND "${CMAKE_BINARY_DIR}/test2.c" " ${name}();\n")
+endforeach()
+file(APPEND "${CMAKE_BINARY_DIR}/test2.c" "}\n")
+
+target_link_libraries(test2 PRIVATE ${test2_names})
+
+install(TARGETS test1 path DESTINATION lib/test1)
+install(TARGETS test2 path DESTINATION lib/test2)
+
+install(CODE [[
+ file(GET_RUNTIME_DEPENDENCIES
+ LIBRARIES
+ "${CMAKE_INSTALL_PREFIX}/lib/test1/$<TARGET_FILE_NAME:test1>"
+ "${CMAKE_INSTALL_PREFIX}/lib/test2/$<TARGET_FILE_NAME:test2>"
+ PRE_INCLUDE_REGEXES "^(lib)?path\\.dll$"
+ PRE_EXCLUDE_REGEXES ".*"
+ )
+ message(FATAL_ERROR "This message should not be displayed")
+ ]])
diff --git a/Tests/RunCMake/install/file-GET_RUNTIME_DEPENDENCIES-windows-notfile-all-result.txt b/Tests/RunCMake/install/file-GET_RUNTIME_DEPENDENCIES-windows-notfile-all-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/install/file-GET_RUNTIME_DEPENDENCIES-windows-notfile-all-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/install/file-GET_RUNTIME_DEPENDENCIES-windows-notfile-all-stderr.txt b/Tests/RunCMake/install/file-GET_RUNTIME_DEPENDENCIES-windows-notfile-all-stderr.txt
new file mode 100644
index 0000000..f921409
--- /dev/null
+++ b/Tests/RunCMake/install/file-GET_RUNTIME_DEPENDENCIES-windows-notfile-all-stderr.txt
@@ -0,0 +1,5 @@
+^CMake Error at cmake_install\.cmake:[0-9]+ \(file\):
+ file Failed to run (dumpbin|objdump) on:
+
+ [^
+]*/Tests/RunCMake/install/file-GET_RUNTIME_DEPENDENCIES-windows-notfile-build/root-all/bin/(lib)?test\.dll$
diff --git a/Tests/RunCMake/install/file-GET_RUNTIME_DEPENDENCIES-windows-notfile.cmake b/Tests/RunCMake/install/file-GET_RUNTIME_DEPENDENCIES-windows-notfile.cmake
new file mode 100644
index 0000000..6665a3b
--- /dev/null
+++ b/Tests/RunCMake/install/file-GET_RUNTIME_DEPENDENCIES-windows-notfile.cmake
@@ -0,0 +1,28 @@
+enable_language(C)
+
+file(WRITE "${CMAKE_BINARY_DIR}/test.c" "__declspec(dllexport) void test(void) {}\n")
+file(WRITE "${CMAKE_BINARY_DIR}/main.c" [[__declspec(dllimport) extern void test(void);
+
+int main(void)
+{
+ test();
+ return 0;
+}
+]])
+
+add_library(test SHARED "${CMAKE_BINARY_DIR}/test.c")
+add_executable(exe "${CMAKE_BINARY_DIR}/main.c")
+target_link_libraries(exe PRIVATE test)
+
+install(TARGETS exe DESTINATION bin)
+
+install(CODE [[
+ file(MAKE_DIRECTORY "${CMAKE_INSTALL_PREFIX}/bin/$<TARGET_FILE_NAME:test>")
+ file(GET_RUNTIME_DEPENDENCIES
+ EXECUTABLES
+ "${CMAKE_INSTALL_PREFIX}/bin/$<TARGET_FILE_NAME:exe>"
+ PRE_INCLUDE_REGEXES "^(lib)?test\\.dll$"
+ PRE_EXCLUDE_REGEXES ".*"
+ )
+ message(FATAL_ERROR "This message should not be displayed")
+ ]])
diff --git a/Tests/RunCMake/install/file-GET_RUNTIME_DEPENDENCIES-windows-unresolved-all-result.txt b/Tests/RunCMake/install/file-GET_RUNTIME_DEPENDENCIES-windows-unresolved-all-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/install/file-GET_RUNTIME_DEPENDENCIES-windows-unresolved-all-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/install/file-GET_RUNTIME_DEPENDENCIES-windows-unresolved-all-stderr.txt b/Tests/RunCMake/install/file-GET_RUNTIME_DEPENDENCIES-windows-unresolved-all-stderr.txt
new file mode 100644
index 0000000..a20654c
--- /dev/null
+++ b/Tests/RunCMake/install/file-GET_RUNTIME_DEPENDENCIES-windows-unresolved-all-stderr.txt
@@ -0,0 +1,2 @@
+^CMake Error at cmake_install\.cmake:[0-9]+ \(file\):
+ file Could not resolve file (lib)?unresolved\.dll$
diff --git a/Tests/RunCMake/install/file-GET_RUNTIME_DEPENDENCIES-windows-unresolved.cmake b/Tests/RunCMake/install/file-GET_RUNTIME_DEPENDENCIES-windows-unresolved.cmake
new file mode 100644
index 0000000..4cc74c7
--- /dev/null
+++ b/Tests/RunCMake/install/file-GET_RUNTIME_DEPENDENCIES-windows-unresolved.cmake
@@ -0,0 +1,18 @@
+enable_language(C)
+
+file(WRITE "${CMAKE_BINARY_DIR}/testlib.c" "__declspec(dllimport) extern void unresolved(void);\n__declspec(dllexport) void testlib(void)\n{\n unresolved();\n}\n")
+add_library(testlib SHARED "${CMAKE_BINARY_DIR}/testlib.c")
+file(WRITE "${CMAKE_BINARY_DIR}/unresolved.c" "__declspec(dllexport) void unresolved(void) {}\n")
+add_library(unresolved SHARED "${CMAKE_BINARY_DIR}/unresolved.c")
+target_link_libraries(testlib PRIVATE unresolved)
+install(TARGETS testlib DESTINATION lib)
+
+install(CODE [[
+ file(GET_RUNTIME_DEPENDENCIES
+ PRE_INCLUDE_REGEXES "^(lib)?unresolved\\.dll$"
+ PRE_EXCLUDE_REGEXES ".*"
+ LIBRARIES
+ "${CMAKE_INSTALL_PREFIX}/lib/$<TARGET_FILE_NAME:testlib>"
+ )
+ message(FATAL_ERROR "This message should not be displayed")
+ ]])
diff --git a/Tests/RunCMake/install/file-GET_RUNTIME_DEPENDENCIES-windows.cmake b/Tests/RunCMake/install/file-GET_RUNTIME_DEPENDENCIES-windows.cmake
new file mode 100644
index 0000000..19288d8
--- /dev/null
+++ b/Tests/RunCMake/install/file-GET_RUNTIME_DEPENDENCIES-windows.cmake
@@ -0,0 +1,114 @@
+enable_language(C)
+
+set(testlib_names
+ preexcluded
+ libdir_postexcluded
+ libdir
+ search_postexcluded
+ search
+ unresolved
+ conflict
+ )
+
+file(REMOVE "${CMAKE_BINARY_DIR}/testlib.c")
+add_library(testlib SHARED "${CMAKE_BINARY_DIR}/testlib.c")
+foreach(name ${testlib_names})
+ file(WRITE "${CMAKE_BINARY_DIR}/${name}.c" "__declspec(dllexport) void ${name}(void) {}\n")
+ add_library(${name} SHARED "${CMAKE_BINARY_DIR}/${name}.c")
+
+ file(APPEND "${CMAKE_BINARY_DIR}/testlib.c" "__declspec(dllimport) extern void ${name}(void);\n")
+endforeach()
+file(APPEND "${CMAKE_BINARY_DIR}/testlib.c" "__declspec(dllexport) void testlib(void)\n{\n")
+foreach(name ${testlib_names})
+ file(APPEND "${CMAKE_BINARY_DIR}/testlib.c" " ${name}();\n")
+endforeach()
+file(APPEND "${CMAKE_BINARY_DIR}/testlib.c" "}\n")
+
+target_link_libraries(testlib PRIVATE ${testlib_names})
+
+file(WRITE "${CMAKE_BINARY_DIR}/testlib_conflict.c" "__declspec(dllimport) extern void conflict(void);\n__declspec(dllexport) void testlib_conflict(void)\n{\n conflict();\n}\n")
+add_library(testlib_conflict SHARED "${CMAKE_BINARY_DIR}/testlib_conflict.c")
+target_link_libraries(testlib_conflict PRIVATE conflict)
+
+file(WRITE "${CMAKE_BINARY_DIR}/testlib_noconflict.c" "__declspec(dllimport) extern void libdir(void);\n__declspec(dllexport) void testlib_noconflict(void)\n{\n libdir();\n}\n")
+add_library(testlib_noconflict SHARED "${CMAKE_BINARY_DIR}/testlib_noconflict.c")
+target_link_libraries(testlib_noconflict PRIVATE libdir)
+
+install(TARGETS testlib libdir_postexcluded libdir conflict testlib_noconflict DESTINATION bin)
+install(TARGETS libdir search_postexcluded search DESTINATION bin/.search) # Prefixing with "." ensures it is the first item after list(SORT)
+install(TARGETS testlib_conflict conflict DESTINATION bin/.conflict)
+
+add_executable(topexe file-GET_RUNTIME_DEPENDENCIES-windows/topexe.c)
+add_library(toplib SHARED file-GET_RUNTIME_DEPENDENCIES-windows/toplib.c)
+add_library(topmod MODULE file-GET_RUNTIME_DEPENDENCIES-windows/toplib.c)
+target_link_libraries(topexe PRIVATE testlib)
+target_link_libraries(toplib PRIVATE testlib)
+target_link_libraries(topmod PRIVATE testlib)
+
+install(TARGETS topexe toplib topmod DESTINATION bin)
+
+install(CODE [[
+ function(exec_get_runtime_dependencies depsfile udepsfile cdepsfile)
+ file(GET_RUNTIME_DEPENDENCIES
+ RESOLVED_DEPENDENCIES_VAR deps
+ UNRESOLVED_DEPENDENCIES_VAR udeps
+ CONFLICTING_DEPENDENCIES_PREFIX cdeps
+ PRE_INCLUDE_REGEXES
+ "^(lib)?testlib\\.dll$"
+ "^(lib)?libdir_postexcluded\\.dll$"
+ "^(lib)?libdir\\.dll$"
+ "^(lib)?search_postexcluded\\.dll$"
+ "^(lib)?search\\.dll$"
+ "^(lib)?unresolved\\.dll$"
+ "^(lib)?conflict\\.dll$"
+ "^kernel32\\.dll$"
+ PRE_EXCLUDE_REGEXES ".*"
+ POST_INCLUDE_REGEXES
+ "^.*/(lib)?testlib\\.dll$"
+ "^.*/(lib)?libdir\\.dll$"
+ "^.*/(lib)?search\\.dll$"
+ "^.*/(lib)?conflict\\.dll$"
+ POST_EXCLUDE_REGEXES ".*"
+ DIRECTORIES
+ "${CMAKE_INSTALL_PREFIX}/bin/.search"
+ ${ARGN}
+ )
+ list(SORT deps)
+ list(SORT udeps)
+ list(SORT cdeps_FILENAMES)
+ file(WRITE "${CMAKE_INSTALL_PREFIX}/deps/${depsfile}" "${deps}")
+ file(WRITE "${CMAKE_INSTALL_PREFIX}/deps/${udepsfile}" "${udeps}")
+ file(WRITE "${CMAKE_INSTALL_PREFIX}/deps/${cdepsfile}" "")
+ foreach(cdep IN LISTS cdeps_FILENAMES)
+ set(cdep_values ${cdeps_${cdep}})
+ list(SORT cdep_values)
+ file(APPEND "${CMAKE_INSTALL_PREFIX}/deps/${cdepsfile}" "${cdep}:${cdep_values}\n")
+ endforeach()
+ endfunction()
+
+ exec_get_runtime_dependencies(
+ deps1.txt udeps1.txt cdeps1.txt
+ EXECUTABLES
+ "${CMAKE_INSTALL_PREFIX}/bin/$<TARGET_FILE_NAME:topexe>"
+ LIBRARIES
+ "${CMAKE_INSTALL_PREFIX}/bin/.conflict/$<TARGET_FILE_NAME:testlib_conflict>"
+ "${CMAKE_INSTALL_PREFIX}/bin/.conflict/../$<TARGET_FILE_NAME:testlib_noconflict>"
+ )
+
+ exec_get_runtime_dependencies(
+ deps2.txt udeps2.txt cdeps2.txt
+ LIBRARIES
+ "${CMAKE_INSTALL_PREFIX}/bin/$<TARGET_FILE_NAME:toplib>"
+ "${CMAKE_INSTALL_PREFIX}/bin/.conflict/$<TARGET_FILE_NAME:testlib_conflict>"
+ "${CMAKE_INSTALL_PREFIX}/bin/.conflict/../$<TARGET_FILE_NAME:testlib_noconflict>"
+ )
+
+ exec_get_runtime_dependencies(
+ deps3.txt udeps3.txt cdeps3.txt
+ MODULES
+ "${CMAKE_INSTALL_PREFIX}/bin/$<TARGET_FILE_NAME:topmod>"
+ LIBRARIES
+ "${CMAKE_INSTALL_PREFIX}/bin/.conflict/$<TARGET_FILE_NAME:testlib_conflict>"
+ "${CMAKE_INSTALL_PREFIX}/bin/.conflict/../$<TARGET_FILE_NAME:testlib_noconflict>"
+ )
+ ]])
diff --git a/Tests/RunCMake/install/file-GET_RUNTIME_DEPENDENCIES-windows/topexe.c b/Tests/RunCMake/install/file-GET_RUNTIME_DEPENDENCIES-windows/topexe.c
new file mode 100644
index 0000000..713b8eb
--- /dev/null
+++ b/Tests/RunCMake/install/file-GET_RUNTIME_DEPENDENCIES-windows/topexe.c
@@ -0,0 +1,7 @@
+__declspec(dllimport) extern void testlib(void);
+
+int main(void)
+{
+ testlib();
+ return 0;
+}
diff --git a/Tests/RunCMake/install/file-GET_RUNTIME_DEPENDENCIES-windows/toplib.c b/Tests/RunCMake/install/file-GET_RUNTIME_DEPENDENCIES-windows/toplib.c
new file mode 100644
index 0000000..6997175
--- /dev/null
+++ b/Tests/RunCMake/install/file-GET_RUNTIME_DEPENDENCIES-windows/toplib.c
@@ -0,0 +1,6 @@
+__declspec(dllimport) extern void testlib(void);
+
+__declspec(dllexport) void toplib(void)
+{
+ testlib();
+}
diff --git a/Tests/RunCMake/install/install_script.cmake b/Tests/RunCMake/install/install_script.cmake
new file mode 100644
index 0000000..1f8522c
--- /dev/null
+++ b/Tests/RunCMake/install/install_script.cmake
@@ -0,0 +1,5 @@
+function(write_empty_file FILENAME)
+ file(WRITE "${CMAKE_INSTALL_PREFIX}/${FILENAME}" "")
+endfunction()
+
+write_empty_file(empty1.txt)
diff --git a/Tests/RunCMake/install/main.c b/Tests/RunCMake/install/main.c
new file mode 100644
index 0000000..8488f4e
--- /dev/null
+++ b/Tests/RunCMake/install/main.c
@@ -0,0 +1,4 @@
+int main(void)
+{
+ return 0;
+}
diff --git a/Tests/RunCMake/install/obj1.c b/Tests/RunCMake/install/obj1.c
new file mode 100644
index 0000000..70007df
--- /dev/null
+++ b/Tests/RunCMake/install/obj1.c
@@ -0,0 +1,7 @@
+#ifdef _WIN32
+__declspec(dllexport)
+#endif
+ int obj1(void)
+{
+ return 0;
+}
diff --git a/Tests/RunCMake/install/obj1.h b/Tests/RunCMake/install/obj1.h
new file mode 100644
index 0000000..d88d5d2
--- /dev/null
+++ b/Tests/RunCMake/install/obj1.h
@@ -0,0 +1,6 @@
+#ifndef OBJ1_H
+#define OBJ1_H
+
+int obj1(void);
+
+#endif /* OBJ1_H */
diff --git a/Tests/RunCMake/install/obj2.c b/Tests/RunCMake/install/obj2.c
new file mode 100644
index 0000000..2dad71e
--- /dev/null
+++ b/Tests/RunCMake/install/obj2.c
@@ -0,0 +1,4 @@
+int obj2(void)
+{
+ return 0;
+}
diff --git a/Tests/RunCMake/install/obj2.h b/Tests/RunCMake/install/obj2.h
new file mode 100644
index 0000000..90bcd34
--- /dev/null
+++ b/Tests/RunCMake/install/obj2.h
@@ -0,0 +1,6 @@
+#ifndef OBJ2_H
+#define OBJ2_H
+
+int obj2(void);
+
+#endif /* OBJ2_H */
diff --git a/Tests/RunCMake/install/obj3.c b/Tests/RunCMake/install/obj3.c
new file mode 100644
index 0000000..991fed3
--- /dev/null
+++ b/Tests/RunCMake/install/obj3.c
@@ -0,0 +1,7 @@
+#ifdef _WIN32
+__declspec(dllexport)
+#endif
+ int obj3(void)
+{
+ return 0;
+}
diff --git a/Tests/RunCMake/install/obj3.h b/Tests/RunCMake/install/obj3.h
new file mode 100644
index 0000000..9e8bb76
--- /dev/null
+++ b/Tests/RunCMake/install/obj3.h
@@ -0,0 +1,6 @@
+#ifndef OBJ3_H
+#define OBJ3_H
+
+int obj3(void);
+
+#endif /* OBJ3_H */
diff --git a/Tests/RunCMake/install/obj4.c b/Tests/RunCMake/install/obj4.c
new file mode 100644
index 0000000..edd6172
--- /dev/null
+++ b/Tests/RunCMake/install/obj4.c
@@ -0,0 +1,7 @@
+#ifdef _WIN32
+__declspec(dllexport)
+#endif
+ int obj4(void)
+{
+ return 0;
+}
diff --git a/Tests/RunCMake/install/obj4.h b/Tests/RunCMake/install/obj4.h
new file mode 100644
index 0000000..6195aa7
--- /dev/null
+++ b/Tests/RunCMake/install/obj4.h
@@ -0,0 +1,6 @@
+#ifndef OBJ4_H
+#define OBJ4_H
+
+int obj4(void);
+
+#endif /* OBJ4_H */
diff --git a/Tests/RunCMake/install/obj5.c b/Tests/RunCMake/install/obj5.c
new file mode 100644
index 0000000..df3e997
--- /dev/null
+++ b/Tests/RunCMake/install/obj5.c
@@ -0,0 +1,7 @@
+#ifdef _WIN32
+__declspec(dllexport)
+#endif
+ int obj5(void)
+{
+ return 0;
+}
diff --git a/Tests/RunCMake/install/obj5.h b/Tests/RunCMake/install/obj5.h
new file mode 100644
index 0000000..a16a1b0
--- /dev/null
+++ b/Tests/RunCMake/install/obj5.h
@@ -0,0 +1,6 @@
+#ifndef OBJ5_H
+#define OBJ5_H
+
+int obj5(void);
+
+#endif /* OBJ5_H */
diff --git a/Tests/RunCMake/install/pattern/empty.c b/Tests/RunCMake/install/pattern/empty.c
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/Tests/RunCMake/install/pattern/empty.c
diff --git a/Tests/RunCMake/install/pattern/empty.h b/Tests/RunCMake/install/pattern/empty.h
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/Tests/RunCMake/install/pattern/empty.h
diff --git a/Tests/RunCMake/install/pattern/empty.txt b/Tests/RunCMake/install/pattern/empty.txt
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/Tests/RunCMake/install/pattern/empty.txt
diff --git a/Tests/RunCMake/install/postinstall.cmake b/Tests/RunCMake/install/postinstall.cmake
new file mode 100644
index 0000000..7607f40
--- /dev/null
+++ b/Tests/RunCMake/install/postinstall.cmake
@@ -0,0 +1 @@
+file(WRITE "${CMAKE_INSTALL_PREFIX}/postinstall" "postinstall")
diff --git a/Tests/RunCMake/install/preinstall.cmake b/Tests/RunCMake/install/preinstall.cmake
new file mode 100644
index 0000000..4b28d16
--- /dev/null
+++ b/Tests/RunCMake/install/preinstall.cmake
@@ -0,0 +1 @@
+file(WRITE "${CMAKE_INSTALL_PREFIX}/preinstall" "preinstall")
diff --git a/Tests/RunCMake/install/script b/Tests/RunCMake/install/script
new file mode 100755
index 0000000..81f9f53
--- /dev/null
+++ b/Tests/RunCMake/install/script
@@ -0,0 +1,2 @@
+#!/bin/sh
+echo "Sample Script Output"
diff --git a/Tests/RunCMake/install/script.bat b/Tests/RunCMake/install/script.bat
new file mode 100755
index 0000000..a9af38c
--- /dev/null
+++ b/Tests/RunCMake/install/script.bat
@@ -0,0 +1 @@
+@echo Sample Script Output
diff --git a/Tests/RunCMake/install/testobj1.c b/Tests/RunCMake/install/testobj1.c
new file mode 100644
index 0000000..081ef20
--- /dev/null
+++ b/Tests/RunCMake/install/testobj1.c
@@ -0,0 +1,9 @@
+#ifdef _WIN32
+__declspec(dllimport)
+#endif
+ int obj1(void);
+
+int main(void)
+{
+ return obj1();
+}