From 764f6838a75edd42c4b78dd50c539896790b2229 Mon Sep 17 00:00:00 2001 From: David Cole Date: Wed, 26 Dec 2007 16:57:13 -0500 Subject: ENH: Give Mac installers package relocation capability. Default location is still the same for backwards compatibility, but packages will now be relocatable by default like they are on Windows via the NSIS installer. New CPack variables for controlling this functionality are CPACK_PACKAGE_DEFAULT_LOCATION and CPACK_PACKAGE_RELOCATABLE. --- CMakeCPackOptions.cmake.in | 4 ++++ Modules/CPack.Info.plist.in | 4 ++-- Modules/CPack.cmake | 9 +++++++++ 3 files changed, 15 insertions(+), 2 deletions(-) diff --git a/CMakeCPackOptions.cmake.in b/CMakeCPackOptions.cmake.in index 9175a5e..6810b33 100644 --- a/CMakeCPackOptions.cmake.in +++ b/CMakeCPackOptions.cmake.in @@ -34,3 +34,7 @@ if(CPACK_GENERATOR MATCHES "CygwinSource") SET(CPACK_SOURCE_IGNORE_FILES "/CVS/" "/\\.build/" "/\\.svn/" "\\.swp$" "\\.#" "/#" "~$") endif(CPACK_GENERATOR MATCHES "CygwinSource") + +if("${CPACK_GENERATOR}" STREQUAL "PackageMaker") + SET(CPACK_PACKAGING_INSTALL_PREFIX "/usr") +endif("${CPACK_GENERATOR}" STREQUAL "PackageMaker") diff --git a/Modules/CPack.Info.plist.in b/Modules/CPack.Info.plist.in index 58dabad..da4872b 100644 --- a/Modules/CPack.Info.plist.in +++ b/Modules/CPack.Info.plist.in @@ -12,7 +12,7 @@ IFPkgFlagAuthorizationAction AdminAuthorization IFPkgFlagDefaultLocation -/ +@CPACK_PACKAGE_DEFAULT_LOCATION@ IFPkgFlagInstallFat IFPkgFlagIsRequired @@ -20,7 +20,7 @@ IFPkgFlagOverwritePermissions IFPkgFlagRelocatable - +<@CPACK_PACKAGE_RELOCATABLE@/> IFPkgFlagRestartAction NoRestart IFPkgFlagRootVolumeOnly diff --git a/Modules/CPack.cmake b/Modules/CPack.cmake index eb9ba43..b0075ac 100644 --- a/Modules/CPack.cmake +++ b/Modules/CPack.cmake @@ -78,6 +78,15 @@ cpack_set_if_not_set(CPACK_PACKAGE_INSTALL_DIRECTORY "${CPACK_PACKAGE_NAME} ${CPACK_PACKAGE_VERSION}") cpack_set_if_not_set(CPACK_PACKAGE_INSTALL_REGISTRY_KEY "${CPACK_PACKAGE_NAME} ${CPACK_PACKAGE_VERSION}") +cpack_set_if_not_set(CPACK_PACKAGE_DEFAULT_LOCATION "/") +cpack_set_if_not_set(CPACK_PACKAGE_RELOCATABLE "true") + +# always force to exactly "true" or "false" for CPack.Info.plist.in: +if(CPACK_PACKAGE_RELOCATABLE) + set(CPACK_PACKAGE_RELOCATABLE "true") +else(CPACK_PACKAGE_RELOCATABLE) + set(CPACK_PACKAGE_RELOCATABLE "false") +endif(CPACK_PACKAGE_RELOCATABLE) macro(cpack_check_file_exists file description) if(NOT EXISTS "${file}") -- cgit v0.12