summaryrefslogtreecommitdiffstats
path: root/Tests
diff options
context:
space:
mode:
authorKyle Edwards <kyle.edwards@kitware.com>2020-01-10 18:48:40 (GMT)
committerKitware Robot <kwrobot@kitware.com>2020-01-10 18:48:47 (GMT)
commit78f9c9dd0e497641e1383a7da2d6cac071cfde46 (patch)
tree85c9402e6fcb9def5a5ae89e4a5732bffcf7348c /Tests
parent4409bfbe9b1d8d977cfb3b107e2dac344ba99dfd (diff)
parentebfffc609e2bfe974a0f56b64285089e7eac4257 (diff)
downloadCMake-78f9c9dd0e497641e1383a7da2d6cac071cfde46.zip
CMake-78f9c9dd0e497641e1383a7da2d6cac071cfde46.tar.gz
CMake-78f9c9dd0e497641e1383a7da2d6cac071cfde46.tar.bz2
Merge topic 'nsis-headerimage'
ebfffc609e CPack/NSIS: Add option for setting MUI_HEADERIMAGE_BITMAP Acked-by: Kitware Robot <kwrobot@kitware.com> Merge-request: !4157
Diffstat (limited to 'Tests')
-rw-r--r--Tests/CMakeLists.txt21
-rw-r--r--Tests/CPackNSISGenerator/CMakeLists.txt20
-rw-r--r--Tests/CPackNSISGenerator/RunCPackVerifyResult.cmake46
-rw-r--r--Tests/CPackNSISGenerator/header-icon.bmpbin0 -> 28166 bytes
-rw-r--r--Tests/CPackNSISGenerator/header-image.bmpbin0 -> 28166 bytes
-rw-r--r--Tests/CPackNSISGenerator/install.icobin0 -> 838 bytes
-rw-r--r--Tests/CPackNSISGenerator/main.cpp4
-rw-r--r--Tests/CPackNSISGenerator/uninstall.icobin0 -> 838 bytes
8 files changed, 91 insertions, 0 deletions
diff --git a/Tests/CMakeLists.txt b/Tests/CMakeLists.txt
index 90eed4f..4fdd7c8 100644
--- a/Tests/CMakeLists.txt
+++ b/Tests/CMakeLists.txt
@@ -989,6 +989,27 @@ ${CMake_SOURCE_DIR}/Utilities/Release/push.bash --dir dev -- '${CMake_BUILD_NIGH
endif()
endif()
+ # On Windows run the CPackNSISGenerator test
+ # if the nsis is available
+ if(WIN32 AND NSIS_MAKENSIS_EXECUTABLE)
+ add_test(CPackNSISGenerator ${CMAKE_CTEST_COMMAND}
+ -C \${CTEST_CONFIGURATION_TYPE}
+ --build-and-test
+ "${CMake_SOURCE_DIR}/Tests/CPackNSISGenerator"
+ "${CMake_BINARY_DIR}/Tests/CPackNSISGenerator"
+ ${build_generator_args}
+ --build-project CPackNSISGenerator
+ --build-options
+ --test-command ${CMAKE_CMAKE_COMMAND}
+ "-DCPackNSISGenerator_BINARY_DIR:PATH=${CMake_BINARY_DIR}/Tests/CPackNSISGenerator"
+ "-Dconfig=\${CTEST_CONFIGURATION_TYPE}"
+ -P "${CMake_SOURCE_DIR}/Tests/CPackNSISGenerator/RunCPackVerifyResult.cmake")
+
+ set_property(TEST CPackNSISGenerator PROPERTY
+ ATTACHED_FILES_ON_FAIL
+ "${CMake_BINARY_DIR}/Tests/CPackNSISGenerator/_CPack_Packages/win32/NSIS/NSISOutput.log")
+ endif()
+
if(CTEST_TEST_CPACK)
add_test(CPackUseDefaultVersion ${CMAKE_CTEST_COMMAND}
--build-and-test
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
new file mode 100644
index 0000000..ef6a656
--- /dev/null
+++ b/Tests/CPackNSISGenerator/header-icon.bmp
Binary files differ
diff --git a/Tests/CPackNSISGenerator/header-image.bmp b/Tests/CPackNSISGenerator/header-image.bmp
new file mode 100644
index 0000000..15b1730
--- /dev/null
+++ b/Tests/CPackNSISGenerator/header-image.bmp
Binary files differ
diff --git a/Tests/CPackNSISGenerator/install.ico b/Tests/CPackNSISGenerator/install.ico
new file mode 100644
index 0000000..3b1e480
--- /dev/null
+++ b/Tests/CPackNSISGenerator/install.ico
Binary files differ
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
new file mode 100644
index 0000000..c4f6316
--- /dev/null
+++ b/Tests/CPackNSISGenerator/uninstall.ico
Binary files differ