summaryrefslogtreecommitdiffstats
path: root/Tests/CPackComponentsForAll/CMakeLists.txt
diff options
context:
space:
mode:
authorDomen Vrankar <domen.vrankar@gmail.com>2015-03-29 18:55:20 (GMT)
committerBrad King <brad.king@kitware.com>2015-03-31 18:04:13 (GMT)
commit681f3a2f012dcd17f63faa3c6f932ae92278e3bd (patch)
treeb0e0c871e1c5813b89f0ef5479991a64d1907150 /Tests/CPackComponentsForAll/CMakeLists.txt
parentc1f8c6cdf94d650df1bd8ec847ae7ac453550978 (diff)
downloadCMake-681f3a2f012dcd17f63faa3c6f932ae92278e3bd.zip
CMake-681f3a2f012dcd17f63faa3c6f932ae92278e3bd.tar.gz
CMake-681f3a2f012dcd17f63faa3c6f932ae92278e3bd.tar.bz2
CPackRPM: Add basic symlink support (#15209)
RPM packages can contain symbolic links to relative paths - including support for multiple relocation paths through generation of post install relocation scripts. Add basic support with limitations described in documentation.
Diffstat (limited to 'Tests/CPackComponentsForAll/CMakeLists.txt')
-rw-r--r--Tests/CPackComponentsForAll/CMakeLists.txt41
1 files changed, 40 insertions, 1 deletions
diff --git a/Tests/CPackComponentsForAll/CMakeLists.txt b/Tests/CPackComponentsForAll/CMakeLists.txt
index 51af297..1cc34b0 100644
--- a/Tests/CPackComponentsForAll/CMakeLists.txt
+++ b/Tests/CPackComponentsForAll/CMakeLists.txt
@@ -49,6 +49,44 @@ install(FILES mylib.h
DESTINATION include
COMPONENT headers)
+if("${CPACK_GENERATOR}" MATCHES "RPM")
+ # Package symbolic links
+ install(DIRECTORY DESTINATION ${CMAKE_INSTALL_LIBDIR}/inside_relocatable_one/depth_two/depth_three COMPONENT libraries)
+ install(DIRECTORY DESTINATION ${CMAKE_INSTALL_LIBDIR}/inside_relocatable_two/depth_two/different_relocatable/bar COMPONENT libraries)
+ install(DIRECTORY DESTINATION other_relocatable/depth_two COMPONENT libraries)
+ install(DIRECTORY DESTINATION non_relocatable/depth_two COMPONENT libraries)
+ # test symbolic links to same dir
+ execute_process(COMMAND ${CMAKE_COMMAND} -E create_symlink depth_three symlink_samedir_path)
+ install(FILES ${CMAKE_CURRENT_BINARY_DIR}/symlink_samedir_path DESTINATION ${CMAKE_INSTALL_LIBDIR}/inside_relocatable_one/depth_two COMPONENT libraries)
+ # test symbolic links to same dir with current dir ./ prefix
+ execute_process(COMMAND ${CMAKE_COMMAND} -E create_symlink ./depth_three symlink_samedir_path_current_dir)
+ install(FILES ${CMAKE_CURRENT_BINARY_DIR}/symlink_samedir_path_current_dir DESTINATION ${CMAKE_INSTALL_LIBDIR}/inside_relocatable_one/depth_two COMPONENT libraries)
+ # test symbolic links to same dir with longer relative path
+ execute_process(COMMAND ${CMAKE_COMMAND} -E create_symlink ../../../${CMAKE_INSTALL_LIBDIR}/.././${CMAKE_INSTALL_LIBDIR}/inside_relocatable_one/./depth_two/depth_three symlink_samedir_path_longer)
+ install(FILES ${CMAKE_CURRENT_BINARY_DIR}/symlink_samedir_path_longer DESTINATION ${CMAKE_INSTALL_LIBDIR}/inside_relocatable_one/depth_two COMPONENT libraries)
+ # test symbolic links to sub dir
+ execute_process(COMMAND ${CMAKE_COMMAND} -E create_symlink ../../${CMAKE_INSTALL_LIBDIR}/inside_relocatable_one/depth_two/depth_three symlink_subdir_path)
+ install(FILES ${CMAKE_CURRENT_BINARY_DIR}/symlink_subdir_path DESTINATION ${CMAKE_INSTALL_LIBDIR}/inside_relocatable_one COMPONENT libraries)
+ # test symbolic links to parent dir
+ execute_process(COMMAND ${CMAKE_COMMAND} -E create_symlink .././../../../${CMAKE_INSTALL_LIBDIR}/inside_relocatable_one/./depth_two symlink_parentdir_path)
+ install(FILES ${CMAKE_CURRENT_BINARY_DIR}/symlink_parentdir_path DESTINATION ${CMAKE_INSTALL_LIBDIR}/inside_relocatable_one/depth_two/depth_three COMPONENT libraries)
+ # test symbolic link to another relocatable path
+ execute_process(COMMAND ${CMAKE_COMMAND} -E create_symlink .././.././../other_relocatable/./depth_two symlink_other_relocatable_path)
+ install(FILES ${CMAKE_CURRENT_BINARY_DIR}/symlink_other_relocatable_path DESTINATION ${CMAKE_INSTALL_LIBDIR}/inside_relocatable_two/depth_two COMPONENT libraries)
+ # test symbolic link to non relocatable path
+ execute_process(COMMAND ${CMAKE_COMMAND} -E create_symlink .././../../non_relocatable/./depth_two symlink_to_non_relocatable_path)
+ install(FILES ${CMAKE_CURRENT_BINARY_DIR}/symlink_to_non_relocatable_path DESTINATION ${CMAKE_INSTALL_LIBDIR}/inside_relocatable_two/depth_two COMPONENT libraries)
+ # test symbolic link from non relocatable path
+ execute_process(COMMAND ${CMAKE_COMMAND} -E create_symlink .././../${CMAKE_INSTALL_LIBDIR}/inside_relocatable_two/depth_two symlink_from_non_relocatable_path)
+ install(FILES ${CMAKE_CURRENT_BINARY_DIR}/symlink_from_non_relocatable_path DESTINATION non_relocatable/depth_two COMPONENT libraries)
+ # test symbolic link relocatable path to its relocatable subpath
+ execute_process(COMMAND ${CMAKE_COMMAND} -E create_symlink ../../inside_relocatable_two/depth_two/different_relocatable/bar symlink_relocatable_subpath)
+ install(FILES ${CMAKE_CURRENT_BINARY_DIR}/symlink_relocatable_subpath DESTINATION ${CMAKE_INSTALL_LIBDIR}/inside_relocatable_one/depth_two COMPONENT libraries)
+ # test symbolic link to location outside package
+ execute_process(COMMAND ${CMAKE_COMMAND} -E create_symlink ./outside_package symlink_outside_package)
+ install(FILES ${CMAKE_CURRENT_BINARY_DIR}/symlink_outside_package DESTINATION ${CMAKE_INSTALL_LIBDIR}/inside_relocatable_one/depth_two COMPONENT libraries)
+endif()
+
# CPack boilerplate for this project
set(CPACK_PACKAGE_NAME "MyLib")
set(CPACK_PACKAGE_CONTACT "None")
@@ -114,7 +152,8 @@ set(CPACK_COMPONENT_APPLICATIONS_INSTALL_TYPES Full)
# can not be used in CPack scripts due to CMAKE_SIZEOF_VOID_P
# variable not being set
set(CPACK_RPM_RELOCATION_PATHS "${CMAKE_INSTALL_INCLUDEDIR}"
- "${CMAKE_INSTALL_LIBDIR}" "${CMAKE_INSTALL_BINDIR}")
+ "${CMAKE_INSTALL_LIBDIR}" "${CMAKE_INSTALL_BINDIR}" "other_relocatable"
+ "${CMAKE_INSTALL_LIBDIR}/inside_relocatable_two/depth_two/different_relocatable")
# We may use the CPack specific config file in order
# to tailor CPack behavior on a CPack generator specific way