diff --git a/llvm/CMakeLists.txt b/llvm/CMakeLists.txt --- a/llvm/CMakeLists.txt +++ b/llvm/CMakeLists.txt @@ -229,23 +229,73 @@ "Default URL where bug reports are to be submitted.") # Configure CPack. -set(CPACK_PACKAGE_INSTALL_DIRECTORY "LLVM") -set(CPACK_PACKAGE_VENDOR "LLVM") -set(CPACK_PACKAGE_VERSION_MAJOR ${LLVM_VERSION_MAJOR}) -set(CPACK_PACKAGE_VERSION_MINOR ${LLVM_VERSION_MINOR}) -set(CPACK_PACKAGE_VERSION_PATCH ${LLVM_VERSION_PATCH}) -set(CPACK_PACKAGE_VERSION ${PACKAGE_VERSION}) -set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/LICENSE.TXT") -set(CPACK_NSIS_COMPRESSOR "/SOLID lzma \r\n SetCompressorDictSize 32") + +# optional toggle to clear any cached packaging settings: +if(LLVM_RESET_PACKAGING_SETTINGS) + foreach(package_var IN ITEMS + CPACK_PACKAGE_INSTALL_DIRECTORY + CPACK_PACKAGE_VENDOR + CPACK_PACKAGE_VERSION_MAJOR + CPACK_PACKAGE_VERSION_MINOR + CPACK_PACKAGE_VERSION_PATCH + CPACK_PACKAGE_VERSION + CPACK_RESOURCE_FILE_LICENSE + CPACK_NSIS_COMPRESSOR + CPACK_PACKAGE_INSTALL_REGISTRY_KEY + CPACK_PACKAGE_ICON + CPACK_NSIS_MUI_ICON + CPACK_NSIS_MUI_UNIICON + CPACK_NSIS_MODIFY_PATH + CPACK_NSIS_ENABLE_UNINSTALL_BEFORE_INSTALL + CPACK_NSIS_INSTALL_ROOT) + unset("${package_var}" CACHE) + endforeach () + unset(LLVM_RESET_PACKAGING_SETTINGS CACHE) +endif() + +set(CPACK_PACKAGE_INSTALL_DIRECTORY "LLVM" CACHE STRING "") +mark_as_advanced(CPACK_PACKAGE_INSTALL_DIRECTORY) +set(CPACK_PACKAGE_VENDOR "LLVM" CACHE STRING "") +mark_as_advanced(CPACK_PACKAGE_VENDOR) + +# note: we want the ability to override version variables via the cache, but if +# we're using the LLVM defaults, we don't want them to "stick" from build to +# build, thus we don't write them to the cache. Cached versions of these +# variables can always be cleared using LLVM_RESET_PACKAGING_SETTINGS (see above) +if(NOT DEFINED CPACK_PACKAGE_VERSION_MAJOR) + set(CPACK_PACKAGE_VERSION_MAJOR ${LLVM_VERSION_MAJOR}) +endif() +if(NOT DEFINED CPACK_PACKAGE_VERSION_MINOR) + set(CPACK_PACKAGE_VERSION_MINOR ${LLVM_VERSION_MINOR}) +endif() +if(NOT DEFINED CPACK_PACKAGE_VERSION_PATCH) + set(CPACK_PACKAGE_VERSION_PATCH ${LLVM_VERSION_PATCH}) +endif() +if(NOT DEFINED CPACK_PACKAGE_VERSION) + set(CPACK_PACKAGE_VERSION ${PACKAGE_VERSION}) +endif() + +set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/LICENSE.TXT" CACHE STRING "") +mark_as_advanced(CPACK_RESOURCE_FILE_LICENSE) +set(CPACK_NSIS_COMPRESSOR "/SOLID lzma \r\n SetCompressorDictSize 32" CACHE STRING "") +mark_as_advanced(CPACK_NSIS_COMPRESSOR) + if(WIN32 AND NOT UNIX) - set(CPACK_PACKAGE_INSTALL_REGISTRY_KEY "LLVM") - set(CPACK_PACKAGE_ICON "${CMAKE_CURRENT_SOURCE_DIR}\\\\cmake\\\\nsis_logo.bmp") - set(CPACK_NSIS_MUI_ICON "${CMAKE_CURRENT_SOURCE_DIR}\\\\cmake\\\\nsis_icon.ico") - set(CPACK_NSIS_MUI_UNIICON "${CMAKE_CURRENT_SOURCE_DIR}\\\\cmake\\\\nsis_icon.ico") - set(CPACK_NSIS_MODIFY_PATH "ON") - set(CPACK_NSIS_ENABLE_UNINSTALL_BEFORE_INSTALL "ON") + set(CPACK_PACKAGE_INSTALL_REGISTRY_KEY "LLVM" CACHE STRING "") + mark_as_advanced(CPACK_PACKAGE_INSTALL_REGISTRY_KEY) + set(CPACK_PACKAGE_ICON "${CMAKE_CURRENT_SOURCE_DIR}\\\\cmake\\\\nsis_logo.bmp" CACHE STRING "") + mark_as_advanced(CPACK_PACKAGE_ICON) + set(CPACK_NSIS_MUI_ICON "${CMAKE_CURRENT_SOURCE_DIR}\\\\cmake\\\\nsis_icon.ico" CACHE STRING "") + mark_as_advanced(CPACK_NSIS_MUI_ICON) + set(CPACK_NSIS_MUI_UNIICON "${CMAKE_CURRENT_SOURCE_DIR}\\\\cmake\\\\nsis_icon.ico" CACHE STRING "") + mark_as_advanced(CPACK_NSIS_MUI_UNIICON) + set(CPACK_NSIS_MODIFY_PATH "ON" CACHE STRING "") + mark_as_advanced(CPACK_NSIS_MODIFY_PATH) + set(CPACK_NSIS_ENABLE_UNINSTALL_BEFORE_INSTALL "ON" CACHE STRING "") + mark_as_advanced(CPACK_NSIS_ENABLE_UNINSTALL_BEFORE_INSTALL) if( CMAKE_CL_64 ) - set(CPACK_NSIS_INSTALL_ROOT "$PROGRAMFILES64") + set(CPACK_NSIS_INSTALL_ROOT "$PROGRAMFILES64" CACHE STRING "") + mark_as_advanced(CPACK_NSIS_INSTALL_ROOT) endif() endif() include(CPack)