diff options
Diffstat (limited to 'Tests/RunCMake/install')
175 files changed, 1735 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..6dd8cdf --- /dev/null +++ b/Tests/RunCMake/install/CMakeLists.txt @@ -0,0 +1,3 @@ +cmake_minimum_required(VERSION 3.4) +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-NamelinkOnly.cmake b/Tests/RunCMake/install/EXPORT-NamelinkOnly.cmake new file mode 100644 index 0000000..1c310d1 --- /dev/null +++ b/Tests/RunCMake/install/EXPORT-NamelinkOnly.cmake @@ -0,0 +1,12 @@ +enable_language(C) +add_library(foo SHARED empty.c) +install(TARGETS foo EXPORT fooExport + RUNTIME DESTINATION bin + LIBRARY + DESTINATION lib + NAMELINK_ONLY +) +install(EXPORT fooExport + DESTINATION "lib/cmake/" + FILE "foo.cmake" +) 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/EXPORT-SeparateNamelink.cmake b/Tests/RunCMake/install/EXPORT-SeparateNamelink.cmake new file mode 100644 index 0000000..5c6fa10 --- /dev/null +++ b/Tests/RunCMake/install/EXPORT-SeparateNamelink.cmake @@ -0,0 +1,19 @@ +enable_language(C) +add_library(foo SHARED empty.c) +install(TARGETS foo EXPORT fooExport + RUNTIME DESTINATION bin + LIBRARY + DESTINATION lib + COMPONENT runtime + NAMELINK_SKIP +) +install(TARGETS foo EXPORT fooExport + LIBRARY + DESTINATION lib + COMPONENT development + NAMELINK_ONLY +) +install(EXPORT fooExport + DESTINATION "lib/cmake/" + FILE "foo.cmake" +) diff --git a/Tests/RunCMake/install/EXPORT-UnknownExport-result.txt b/Tests/RunCMake/install/EXPORT-UnknownExport-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/install/EXPORT-UnknownExport-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/install/EXPORT-UnknownExport-stderr.txt b/Tests/RunCMake/install/EXPORT-UnknownExport-stderr.txt new file mode 100644 index 0000000..bd49fa2 --- /dev/null +++ b/Tests/RunCMake/install/EXPORT-UnknownExport-stderr.txt @@ -0,0 +1 @@ +CMake Error: INSTALL\(EXPORT\) given unknown export "fooExport" diff --git a/Tests/RunCMake/install/EXPORT-UnknownExport.cmake b/Tests/RunCMake/install/EXPORT-UnknownExport.cmake new file mode 100644 index 0000000..2dbba4e --- /dev/null +++ b/Tests/RunCMake/install/EXPORT-UnknownExport.cmake @@ -0,0 +1,5 @@ +enable_language(C) +install(EXPORT fooExport + DESTINATION "lib/cmake/" + FILE "foo.cmake" +) 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-EXTRA_ISPC_TARGET_OBJECTS-all-check.cmake b/Tests/RunCMake/install/FILES-EXTRA_ISPC_TARGET_OBJECTS-all-check.cmake new file mode 100644 index 0000000..8750a76 --- /dev/null +++ b/Tests/RunCMake/install/FILES-EXTRA_ISPC_TARGET_OBJECTS-all-check.cmake @@ -0,0 +1,11 @@ + +set(objs obj1 obj2) +set(targets sse2 sse4 avx avx2) +foreach(o IN LISTS objs) + set(item "objs/${o}\\.ispc\\.(o|obj)") + check_installed("${item}") + foreach(t IN LISTS targets) + set(item "objs/${o}\\.ispc_${t}\\.(o|obj)") + check_installed("${item}") + endforeach() +endforeach() diff --git a/Tests/RunCMake/install/FILES-EXTRA_ISPC_TARGET_OBJECTS.cmake b/Tests/RunCMake/install/FILES-EXTRA_ISPC_TARGET_OBJECTS.cmake new file mode 100644 index 0000000..ad542ed --- /dev/null +++ b/Tests/RunCMake/install/FILES-EXTRA_ISPC_TARGET_OBJECTS.cmake @@ -0,0 +1,4 @@ +enable_language(ISPC) +add_library(objs OBJECT obj1.ispc obj2.ispc) +set_target_properties(objs PROPERTIES ISPC_INSTRUCTION_SETS "sse2-i32x4;sse4-i16x8;avx1-i32x16;avx2-i32x4") +install(FILES $<TARGET_OBJECTS:objs> DESTINATION objs) 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-RENAME-all-check.cmake b/Tests/RunCMake/install/FILES-RENAME-all-check.cmake new file mode 100644 index 0000000..7e9b103 --- /dev/null +++ b/Tests/RunCMake/install/FILES-RENAME-all-check.cmake @@ -0,0 +1 @@ +check_installed([[^src;src/script_Debug\.ps]]) diff --git a/Tests/RunCMake/install/FILES-RENAME-bad-result.txt b/Tests/RunCMake/install/FILES-RENAME-bad-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/install/FILES-RENAME-bad-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/install/FILES-RENAME-bad-stderr.txt b/Tests/RunCMake/install/FILES-RENAME-bad-stderr.txt new file mode 100644 index 0000000..9844158 --- /dev/null +++ b/Tests/RunCMake/install/FILES-RENAME-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-RENAME-bad.cmake b/Tests/RunCMake/install/FILES-RENAME-bad.cmake new file mode 100644 index 0000000..5be0bb2 --- /dev/null +++ b/Tests/RunCMake/install/FILES-RENAME-bad.cmake @@ -0,0 +1,4 @@ +install(FILES empty.c + DESTINATION mybin + RENAME $<NOTAGENEX> + ) diff --git a/Tests/RunCMake/install/FILES-RENAME.cmake b/Tests/RunCMake/install/FILES-RENAME.cmake new file mode 100644 index 0000000..5896e64 --- /dev/null +++ b/Tests/RunCMake/install/FILES-RENAME.cmake @@ -0,0 +1,4 @@ +install(FILES script.bat + DESTINATION src + RENAME script_$<CONFIG>.ps + ) 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..efd03df --- /dev/null +++ b/Tests/RunCMake/install/RunCMakeTest.cmake @@ -0,0 +1,177 @@ +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 on which we do not support editing the RPATH. +function(run_cmake_EDIT_RPATH_only case) + if(UNIX AND CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG AND CMAKE_EXECUTABLE_FORMAT MATCHES "^(ELF|XCOFF)$") + 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.") + elseif(CMAKE_SYSTEM_NAME STREQUAL "AIX") + message(FATAL_ERROR "Expected platform AIX to advertize itself as XCOFF-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_EDIT_RPATH_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(FILES-RENAME-bad) +run_cmake(TARGETS-DESTINATION-bad) +run_cmake(EXPORT-OldIFace) +run_cmake(EXPORT-UnknownExport) +run_cmake(EXPORT-NamelinkOnly) +run_cmake(EXPORT-SeparateNamelink) +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) + +set(RunCMake_TEST_OPTIONS "-DCMAKE_BUILD_TYPE:STRING=Debug") +run_install_test(FILES-RENAME) +unset(RunCMake_TEST_OPTIONS) + +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() + +if(CMake_TEST_ISPC) + run_install_test(FILES-EXTRA_ISPC_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) + +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..6b2faa3 --- /dev/null +++ b/Tests/RunCMake/install/TARGETS-FILE_RPATH_CHANGE-check-common.cmake @@ -0,0 +1,32 @@ +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.") + elseif(CMAKE_SYSTEM_NAME STREQUAL "AIX") + message(FATAL_ERROR "Expected generated file(RPATH_CHANGE) rule on platform AIX.") + 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/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/obj1.ispc b/Tests/RunCMake/install/obj1.ispc new file mode 100644 index 0000000..0dc983c --- /dev/null +++ b/Tests/RunCMake/install/obj1.ispc @@ -0,0 +1,4 @@ + +float func1(float a, float b) { + return a + b / 2.; +} 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/obj2.ispc b/Tests/RunCMake/install/obj2.ispc new file mode 100644 index 0000000..7b2aeb9 --- /dev/null +++ b/Tests/RunCMake/install/obj2.ispc @@ -0,0 +1,4 @@ + +float func2(float a, float b) { + return a + b / 2.; +} 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(); +} |