CPack/NSIS: Add option to not display component selection page

Fixes: #27754
This commit is contained in:
Chris Mocock
2026-04-14 15:16:01 +01:00
parent 87dd963851
commit 8046ceadf3
5 changed files with 26 additions and 2 deletions
+6
View File
@@ -249,3 +249,9 @@ on Windows Nullsoft Scriptable Install System.
allowing an install.
Allowed values for this variable are ``on``, ``off``, and ``force``.
If not specified, the default behavior is ``on``.
.. variable:: CPACK_NSIS_IGNORE_COMPONENTS_PAGE
.. versionadded:: 4.4
If set, do not display the page containing the license during installation.
@@ -0,0 +1,6 @@
nsis_ignore_components_page
---------------------------
* The :cpack_gen:`CPack NSIS Generator` gained a new variable
:variable:`CPACK_NSIS_IGNORE_COMPONENTS_PAGE` to ignore the
component selection page in the installer.
+4 -2
View File
@@ -375,8 +375,10 @@ int cmCPackNSISGenerator::PackageFiles()
}
this->SetOptionIfNotSet("CPACK_NSIS_INSTALLATION_TYPES", installTypesCode);
this->SetOptionIfNotSet("CPACK_NSIS_PAGE_COMPONENTS",
"!insertmacro MUI_PAGE_COMPONENTS");
if (!this->IsSet("CPACK_NSIS_IGNORE_COMPONENTS_PAGE")) {
this->SetOptionIfNotSet("CPACK_NSIS_PAGE_COMPONENTS",
"!insertmacro MUI_PAGE_COMPONENTS");
}
this->SetOptionIfNotSet("CPACK_NSIS_FULL_INSTALL", "");
this->SetOptionIfNotSet("CPACK_NSIS_COMPONENT_SECTIONS", componentCode);
this->SetOptionIfNotSet("CPACK_NSIS_COMPONENT_SECTION_LIST", sectionList);
+1
View File
@@ -40,6 +40,7 @@ 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)
set(CPACK_NSIS_IGNORE_COMPONENTS_PAGE ON)
set(CPACK_NSIS_CRC_CHECK "off")
include(CPack)
@@ -70,6 +70,15 @@ else()
message(FATAL_ERROR "License found in the project")
endif()
# components page should not be present
file(STRINGS "${project_file}" line REGEX "!insertmacro MUI_PAGE_COMPONENTS")
string(FIND "${line}" "MUI_PAGE_COMPONENTS" output_index)
if("${output_index}" EQUAL "-1")
message(STATUS "Components page not found in the project")
else()
message(FATAL_ERROR "Components page found in the project")
endif()
file(STRINGS "${project_file}" line REGEX [[\\_CON\\]])
string(FIND "${line}" [[\_CON\]] output_index)
message(STATUS "Found CON component reserved directory name as _CON")