summaryrefslogtreecommitdiffstats
path: root/Tests/RunCMake/install/TARGETS-FILE_RPATH_CHANGE-new_rpath.cmake
diff options
context:
space:
mode:
authorDennis Klein <d.klein@gsi.de>2019-06-13 14:40:01 (GMT)
committerDennis Klein <d.klein@gsi.de>2019-06-13 14:41:11 (GMT)
commit4caefbb42369cf652df920edd07ee9e81eb95577 (patch)
tree4ebb103777b4c69889c25c3c55f7ee3ad571a9c6 /Tests/RunCMake/install/TARGETS-FILE_RPATH_CHANGE-new_rpath.cmake
parent749ce48eb5b2876b347115a857839fdf9c24a221 (diff)
downloadCMake-4caefbb42369cf652df920edd07ee9e81eb95577.zip
CMake-4caefbb42369cf652df920edd07ee9e81eb95577.tar.gz
CMake-4caefbb42369cf652df920edd07ee9e81eb95577.tar.bz2
cmInstallTargetGenerator: Add tests for the RPATH_CHANGE rule
Diffstat (limited to 'Tests/RunCMake/install/TARGETS-FILE_RPATH_CHANGE-new_rpath.cmake')
-rw-r--r--Tests/RunCMake/install/TARGETS-FILE_RPATH_CHANGE-new_rpath.cmake72
1 files changed, 72 insertions, 0 deletions
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})