diff options
author | Johnny Jazeix <jazeix@gmail.com> | 2020-01-02 21:27:31 (GMT) |
---|---|---|
committer | Johnny Jazeix <jazeix@gmail.com> | 2020-01-02 21:27:31 (GMT) |
commit | ebfffc609e2bfe974a0f56b64285089e7eac4257 (patch) | |
tree | 60df1dba2632d514eb1ddee1002ef9e22e9385b0 /Tests/CPackNSISGenerator | |
parent | 77b49149f5fdb9939ffc353996f8b7570e99da4c (diff) | |
download | CMake-ebfffc609e2bfe974a0f56b64285089e7eac4257.zip CMake-ebfffc609e2bfe974a0f56b64285089e7eac4257.tar.gz CMake-ebfffc609e2bfe974a0f56b64285089e7eac4257.tar.bz2 |
CPack/NSIS: Add option for setting MUI_HEADERIMAGE_BITMAP
Fixes: #20120
Diffstat (limited to 'Tests/CPackNSISGenerator')
-rw-r--r-- | Tests/CPackNSISGenerator/CMakeLists.txt | 20 | ||||
-rw-r--r-- | Tests/CPackNSISGenerator/RunCPackVerifyResult.cmake | 46 | ||||
-rw-r--r-- | Tests/CPackNSISGenerator/header-icon.bmp | bin | 0 -> 28166 bytes | |||
-rw-r--r-- | Tests/CPackNSISGenerator/header-image.bmp | bin | 0 -> 28166 bytes | |||
-rw-r--r-- | Tests/CPackNSISGenerator/install.ico | bin | 0 -> 838 bytes | |||
-rw-r--r-- | Tests/CPackNSISGenerator/main.cpp | 4 | ||||
-rw-r--r-- | Tests/CPackNSISGenerator/uninstall.ico | bin | 0 -> 838 bytes |
7 files changed, 70 insertions, 0 deletions
diff --git a/Tests/CPackNSISGenerator/CMakeLists.txt b/Tests/CPackNSISGenerator/CMakeLists.txt new file mode 100644 index 0000000..b8b2ed6 --- /dev/null +++ b/Tests/CPackNSISGenerator/CMakeLists.txt @@ -0,0 +1,20 @@ +cmake_minimum_required(VERSION 3.16) + +project(CPackNSISGenerator) + +add_executable(hello main.cpp) + +install(TARGETS hello + ARCHIVE DESTINATION . + RUNTIME DESTINATION . + LIBRARY DESTINATION . + BUNDLE DESTINATION .) + +set(CPACK_NSIS_MUI_HEADERIMAGE "${PROJECT_SOURCE_DIR}\\\\header-image.bmp") +set(CPACK_PACKAGE_ICON "${PROJECT_SOURCE_DIR}\\\\header-icon.bmp") +set(CPACK_NSIS_MUI_ICON "${PROJECT_SOURCE_DIR}\\\\install.ico") +set(CPACK_NSIS_MUI_UNIICON "${PROJECT_SOURCE_DIR}\\\\uninstall.ico") +set(CPACK_GENERATOR "NSIS") +set(CPACK_NSIS_ENABLE_UNINSTALL_BEFORE_INSTALL ON) + +include(CPack) diff --git a/Tests/CPackNSISGenerator/RunCPackVerifyResult.cmake b/Tests/CPackNSISGenerator/RunCPackVerifyResult.cmake new file mode 100644 index 0000000..f70cd24 --- /dev/null +++ b/Tests/CPackNSISGenerator/RunCPackVerifyResult.cmake @@ -0,0 +1,46 @@ +message(STATUS "=============================================================") +message(STATUS "CTEST_FULL_OUTPUT (Avoid ctest truncation of output)") +message(STATUS "") + +if(NOT CPackNSISGenerator_BINARY_DIR) + message(FATAL_ERROR "CPackNSISGenerator_BINARY_DIR not set") +endif() + +message(STATUS "CMAKE_COMMAND: ${CMAKE_COMMAND}") +message(STATUS "CMAKE_CPACK_COMMAND: ${CMAKE_CPACK_COMMAND}") +message(STATUS "CPackNSISGenerator_BINARY_DIR: ${CPackNSISGenerator_BINARY_DIR}") + +if(config) + set(_C_config -C ${config}) +endif() + +execute_process(COMMAND "${CMAKE_CPACK_COMMAND}" + ${_C_config} + RESULT_VARIABLE CPack_result + OUTPUT_VARIABLE CPack_output + ERROR_VARIABLE CPack_error + WORKING_DIRECTORY "${CPackNSISGenerator_BINARY_DIR}") + +if(CPack_result) + message(FATAL_ERROR "CPack execution went wrong!, CPack_output=${CPack_output}, CPack_error=${CPack_error}") +else () + message(STATUS "CPack_output=${CPack_output}") +endif() + +set(expected_file_mask "${CPackNSISGenerator_BINARY_DIR}/_CPack_Packages/win32/NSIS/*.nsi") +file(GLOB project_file "${expected_file_mask}") + +message(STATUS "project_file='${project_file}'") +message(STATUS "expected_file_mask='${expected_file_mask}'") + +if(NOT project_file) + message(FATAL_ERROR "project_file does not exist.") +endif() + +# should match !define MUI_HEADERIMAGE_BITMAP "${PROJECT_SOURCE_DIR}\header-image.bmp" +file(STRINGS "${project_file}" line REGEX "^!define MUI_HEADERIMAGE_BITMAP") +string(FIND "${line}" "header-image.bmp" output_index) +message(STATUS "Found the bitmap at index ${output_index}") +if("${output_index}" EQUAL "-1") + message(FATAL_ERROR "MUI_HEADERIMAGE_BITMAP not found in the project") +endif() diff --git a/Tests/CPackNSISGenerator/header-icon.bmp b/Tests/CPackNSISGenerator/header-icon.bmp Binary files differnew file mode 100644 index 0000000..ef6a656 --- /dev/null +++ b/Tests/CPackNSISGenerator/header-icon.bmp diff --git a/Tests/CPackNSISGenerator/header-image.bmp b/Tests/CPackNSISGenerator/header-image.bmp Binary files differnew file mode 100644 index 0000000..15b1730 --- /dev/null +++ b/Tests/CPackNSISGenerator/header-image.bmp diff --git a/Tests/CPackNSISGenerator/install.ico b/Tests/CPackNSISGenerator/install.ico Binary files differnew file mode 100644 index 0000000..3b1e480 --- /dev/null +++ b/Tests/CPackNSISGenerator/install.ico diff --git a/Tests/CPackNSISGenerator/main.cpp b/Tests/CPackNSISGenerator/main.cpp new file mode 100644 index 0000000..956f345 --- /dev/null +++ b/Tests/CPackNSISGenerator/main.cpp @@ -0,0 +1,4 @@ +int main() +{ + return 42; +} diff --git a/Tests/CPackNSISGenerator/uninstall.ico b/Tests/CPackNSISGenerator/uninstall.ico Binary files differnew file mode 100644 index 0000000..c4f6316 --- /dev/null +++ b/Tests/CPackNSISGenerator/uninstall.ico |