Merge topic 'cpack-nsis-crc-check'

3c7fee0d99 CPack/NSIS: Allow setting CRCCheck

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !11242
This commit is contained in:
Brad King
2025-09-25 13:14:17 +00:00
committed by Kitware Robot
6 changed files with 29 additions and 0 deletions
+9
View File
@@ -240,3 +240,12 @@ on Windows Nullsoft Scriptable Install System.
where ``<preArgs>...`` is constructed from ``CPACK_NSIS_EXECUTABLE_PRE_ARGUMENTS``
and ``<postArgs>...`` is constructed from ``CPACK_NSIS_EXECUTABLE_POST_ARGUMENTS``.
.. variable:: CPACK_NSIS_CRC_CHECK
.. versionadded:: 4.2
Specifies whether or not the installer will perform a CRC on itself before
allowing an install.
Allowed values for this variable are ``on``, ``off``, and ``force``.
If not specified, the default behavior is ``on``.
@@ -0,0 +1,6 @@
cpack-nsis-crc-check
--------------------
* The :cpack_gen:`CPack NSIS Generator` gained a new
:variable:`CPACK_NSIS_CRC_CHECK` variable for setting the ``CRCCheck``
attribute.
+1
View File
@@ -43,6 +43,7 @@
@CPACK_NSIS_DEFINES@
@CPACK_NSIS_MANIFEST_DPI_AWARE_CODE@
@CPACK_NSIS_BRANDING_TEXT_CODE@
@CPACK_NSIS_CRC_CHECK_CODE@
!include Sections.nsh
+4
View File
@@ -236,6 +236,10 @@ int cmCPackNSISGenerator::PackageFiles()
this->SetOptionIfNotSet("CPACK_NSIS_BRANDING_TEXT_CODE", brandingTextCode);
}
if (cmValue v = this->GetOptionIfSet("CPACK_NSIS_CRC_CHECK")) {
this->SetOption("CPACK_NSIS_CRC_CHECK_CODE", "CRCCheck " + *v);
}
if (!this->IsSet("CPACK_NSIS_IGNORE_LICENSE_PAGE")) {
cmValue v = this->GetOption("CPACK_RESOURCE_FILE_LICENSE");
std::string licenseFile = cmSystemTools::ConvertToWindowsOutputPath(*v);
+1
View File
@@ -40,5 +40,6 @@ 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_CRC_CHECK "off")
include(CPack)
@@ -90,3 +90,11 @@ message(STATUS "Found EndsWithDot. component directory name as EndsWithDot._")
if("${output_index}" EQUAL "-1")
message(FATAL_ERROR "EndsWithDot. component directory name not found as EndsWithDot._ in the project")
endif()
file(STRINGS "${project_file}" line REGEX "^CRCCheck off")
string(FIND "${line}" "off" output_index)
if("${output_index}" EQUAL "-1")
message(FATAL_ERROR "CRCCheck off not found in the project")
else()
message(STATUS "Found CRCCheck")
endif()