diff options
author | Johnny Jazeix <jazeix@gmail.com> | 2020-04-14 11:47:49 (GMT) |
---|---|---|
committer | Johnny Jazeix <jazeix@gmail.com> | 2020-04-14 11:47:49 (GMT) |
commit | d6840a4f3cee501aa910035bb7fa2dad3c8d7f73 (patch) | |
tree | 86fc4c6b95c7e910cb31e4fd6cfaca1faa1d78ef | |
parent | fab932c3cba9423443c7ab25fda3999e4fc4b347 (diff) | |
download | CMake-d6840a4f3cee501aa910035bb7fa2dad3c8d7f73.zip CMake-d6840a4f3cee501aa910035bb7fa2dad3c8d7f73.tar.gz CMake-d6840a4f3cee501aa910035bb7fa2dad3c8d7f73.tar.bz2 |
CPack/NSIS: Add option for setting DPI-aware
See https://nsis.sourceforge.io/Reference/ManifestDPIAware
for more information.
Fixes: #17724
-rw-r--r-- | Help/cpack_gen/nsis.rst | 4 | ||||
-rw-r--r-- | Help/release/dev/nsis-dpi-aware.rst | 6 | ||||
-rw-r--r-- | Modules/Internal/CPack/NSIS.template.in | 1 | ||||
-rw-r--r-- | Source/CPack/cmCPackNSISGenerator.cxx | 5 | ||||
-rw-r--r-- | Tests/CPackNSISGenerator/CMakeLists.txt | 1 | ||||
-rw-r--r-- | Tests/CPackNSISGenerator/RunCPackVerifyResult.cmake | 8 |
6 files changed, 25 insertions, 0 deletions
diff --git a/Help/cpack_gen/nsis.rst b/Help/cpack_gen/nsis.rst index d1e495f..0dd876e 100644 --- a/Help/cpack_gen/nsis.rst +++ b/Help/cpack_gen/nsis.rst @@ -155,3 +155,7 @@ on Windows Nullsoft Scriptable Install System. .. variable:: CPACK_NSIS_MUI_HEADERIMAGE The image to display on the header of installers pages. + +.. variable:: CPACK_NSIS_MANIFEST_DPI_AWARE + + If set, declares that the installer is DPI-aware. diff --git a/Help/release/dev/nsis-dpi-aware.rst b/Help/release/dev/nsis-dpi-aware.rst new file mode 100644 index 0000000..8b5032e --- /dev/null +++ b/Help/release/dev/nsis-dpi-aware.rst @@ -0,0 +1,6 @@ +nsis-dpi-aware +-------------- + +* The :cpack_gen:`CPack NSIS Generator` gained a new variable + :variable:`CPACK_NSIS_MANIFEST_DPI_AWARE` to declare that the + installer is DPI-aware. diff --git a/Modules/Internal/CPack/NSIS.template.in b/Modules/Internal/CPack/NSIS.template.in index 660bfa3..6009ce0 100644 --- a/Modules/Internal/CPack/NSIS.template.in +++ b/Modules/Internal/CPack/NSIS.template.in @@ -41,6 +41,7 @@ RequestExecutionLevel admin @CPACK_NSIS_DEFINES@ +@CPACK_NSIS_MANIFEST_DPI_AWARE_CODE@ !include Sections.nsh diff --git a/Source/CPack/cmCPackNSISGenerator.cxx b/Source/CPack/cmCPackNSISGenerator.cxx index 9afdc62..3067f96 100644 --- a/Source/CPack/cmCPackNSISGenerator.cxx +++ b/Source/CPack/cmCPackNSISGenerator.cxx @@ -203,6 +203,11 @@ int cmCPackNSISGenerator::PackageFiles() "!define MUI_FINISHPAGE_TITLE_3LINES"); } + if (this->IsSet("CPACK_NSIS_MANIFEST_DPI_AWARE")) { + this->SetOptionIfNotSet("CPACK_NSIS_MANIFEST_DPI_AWARE_CODE", + "ManifestDPIAware true"); + } + // 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 b8b2ed6..8ed4d59 100644 --- a/Tests/CPackNSISGenerator/CMakeLists.txt +++ b/Tests/CPackNSISGenerator/CMakeLists.txt @@ -16,5 +16,6 @@ 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) +set(CPACK_NSIS_MANIFEST_DPI_AWARE ON) include(CPack) diff --git a/Tests/CPackNSISGenerator/RunCPackVerifyResult.cmake b/Tests/CPackNSISGenerator/RunCPackVerifyResult.cmake index 01b37c5..bfbcf9c 100644 --- a/Tests/CPackNSISGenerator/RunCPackVerifyResult.cmake +++ b/Tests/CPackNSISGenerator/RunCPackVerifyResult.cmake @@ -44,3 +44,11 @@ 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() + +file(STRINGS "${project_file}" line REGEX "^ManifestDPIAware true") +string(FIND "${line}" "true" output_index) +if("${output_index}" EQUAL "-1") + message(FATAL_ERROR "ManifestDPIAware true not found in the project") +else() + message(STATUS "Found DPI-aware") +endif() |