summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2021-08-03 15:06:06 (GMT)
committerKitware Robot <kwrobot@kitware.com>2021-08-03 15:06:45 (GMT)
commita3ddcdb9111f81771dc2c06d88de84fc1cf00e00 (patch)
tree7b1729ee1578368c6e6967c94301b06079f54ca5
parent1524505e12290e9f4bd9155a6f2e45879d3cb9e5 (diff)
parent795e406e3bbd99024652f44fc121f36cd291c269 (diff)
downloadCMake-a3ddcdb9111f81771dc2c06d88de84fc1cf00e00.zip
CMake-a3ddcdb9111f81771dc2c06d88de84fc1cf00e00.tar.gz
CMake-a3ddcdb9111f81771dc2c06d88de84fc1cf00e00.tar.bz2
Merge topic 'nsis_ignore_license_page'
795e406e3b CPack/NSIS: Add option to not display license page Acked-by: Kitware Robot <kwrobot@kitware.com> Merge-request: !6422
-rw-r--r--Help/cpack_gen/nsis.rst6
-rw-r--r--Help/release/dev/nsis_ignore_install_page.rst6
-rw-r--r--Modules/Internal/CPack/NSIS.template.in2
-rw-r--r--Source/CPack/cmCPackNSISGenerator.cxx7
-rw-r--r--Tests/CPackNSISGenerator/CMakeLists.txt1
-rw-r--r--Tests/CPackNSISGenerator/RunCPackVerifyResult.cmake9
6 files changed, 30 insertions, 1 deletions
diff --git a/Help/cpack_gen/nsis.rst b/Help/cpack_gen/nsis.rst
index 983df77..299cfec 100644
--- a/Help/cpack_gen/nsis.rst
+++ b/Help/cpack_gen/nsis.rst
@@ -201,3 +201,9 @@ on Windows Nullsoft Scriptable Install System.
.. versionadded:: 3.21
If set, specify the name of the NSIS executable. Default is ``makensis``.
+
+.. variable:: CPACK_NSIS_IGNORE_LICENSE_PAGE
+
+ .. versionadded:: 3.22
+
+ If set, do not display the page containing the license during installation.
diff --git a/Help/release/dev/nsis_ignore_install_page.rst b/Help/release/dev/nsis_ignore_install_page.rst
new file mode 100644
index 0000000..2d8a8d0
--- /dev/null
+++ b/Help/release/dev/nsis_ignore_install_page.rst
@@ -0,0 +1,6 @@
+nsis_ignore_install_page
+------------------------
+
+* The :cpack_gen:`CPack NSIS Generator` gained a new variable
+ :variable:`CPACK_NSIS_IGNORE_LICENSE_PAGE` to ignore the
+ license page in the installer.
diff --git a/Modules/Internal/CPack/NSIS.template.in b/Modules/Internal/CPack/NSIS.template.in
index 848691f..1df8a58 100644
--- a/Modules/Internal/CPack/NSIS.template.in
+++ b/Modules/Internal/CPack/NSIS.template.in
@@ -540,7 +540,7 @@ FunctionEnd
@CPACK_NSIS_INSTALLER_WELCOME_TITLE_3LINES_CODE@
!insertmacro MUI_PAGE_WELCOME
- !insertmacro MUI_PAGE_LICENSE "@CPACK_RESOURCE_FILE_LICENSE@"
+ @CPACK_NSIS_LICENSE_PAGE@
Page custom InstallOptionsPage
!insertmacro MUI_PAGE_DIRECTORY
diff --git a/Source/CPack/cmCPackNSISGenerator.cxx b/Source/CPack/cmCPackNSISGenerator.cxx
index 0379232..395b1df 100644
--- a/Source/CPack/cmCPackNSISGenerator.cxx
+++ b/Source/CPack/cmCPackNSISGenerator.cxx
@@ -235,6 +235,13 @@ int cmCPackNSISGenerator::PackageFiles()
brandingTextCode.c_str());
}
+ if (!this->IsSet("CPACK_NSIS_IGNORE_LICENSE_PAGE")) {
+ std::string licenceCode =
+ cmStrCat("!insertmacro MUI_PAGE_LICENSE \"",
+ this->GetOption("CPACK_RESOURCE_FILE_LICENSE"), "\"\n");
+ this->SetOptionIfNotSet("CPACK_NSIS_LICENSE_PAGE", licenceCode.c_str());
+ }
+
// Setup all of the component sections
if (this->Components.empty()) {
this->SetOptionIfNotSet("CPACK_NSIS_INSTALLATION_TYPES", "");
diff --git a/Tests/CPackNSISGenerator/CMakeLists.txt b/Tests/CPackNSISGenerator/CMakeLists.txt
index 64a8ef6..5d6320b 100644
--- a/Tests/CPackNSISGenerator/CMakeLists.txt
+++ b/Tests/CPackNSISGenerator/CMakeLists.txt
@@ -19,5 +19,6 @@ set(CPACK_NSIS_ENABLE_UNINSTALL_BEFORE_INSTALL ON)
set(CPACK_NSIS_MANIFEST_DPI_AWARE ON)
set(CPACK_NSIS_BRANDING_TEXT "CMake branding text")
set(CPACK_NSIS_BRANDING_TEXT_TRIM_POSITION "RIGHT")
+set(CPACK_NSIS_IGNORE_LICENSE_PAGE ON)
include(CPack)
diff --git a/Tests/CPackNSISGenerator/RunCPackVerifyResult.cmake b/Tests/CPackNSISGenerator/RunCPackVerifyResult.cmake
index 8bfcf26..31a2560 100644
--- a/Tests/CPackNSISGenerator/RunCPackVerifyResult.cmake
+++ b/Tests/CPackNSISGenerator/RunCPackVerifyResult.cmake
@@ -60,3 +60,12 @@ if("${output_index}" EQUAL "-1")
else()
message(STATUS "Found BrandingText")
endif()
+
+# license page should not be present
+file(STRINGS "${project_file}" line REGEX "!insertmacro MUI_PAGE_LICENSE")
+string(FIND "${line}" "MUI_PAGE_LICENSE" output_index)
+if("${output_index}" EQUAL "-1")
+ message(STATUS "License not found in the project")
+else()
+ message(FATAL_ERROR "License found in the project")
+endif()