Last active
July 30, 2024 22:12
-
-
Save bjornblissing/6fc452fe7ec1fdfe3419 to your computer and use it in GitHub Desktop.
CMake script to add manifest to exe-file
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Amend manifest to tell Windows that the application is DPI aware (needed for Windows 8.1 and up) | |
IF (MSVC) | |
IF (CMAKE_MAJOR_VERSION LESS 3) | |
MESSAGE(WARNING "CMake version 3.0 or newer is required use build variable TARGET_FILE") | |
ELSE() | |
ADD_CUSTOM_COMMAND( | |
TARGET ${TARGET_TARGETNAME} | |
POST_BUILD | |
COMMAND "mt.exe" -manifest \"${CMAKE_CURRENT_SOURCE_DIR}\\dpiawarescaleing.manifest\" -inputresource:\"$<TARGET_FILE:${TARGET_TARGETNAME}>\"\;\#1 -outputresource:\"$<TARGET_FILE:${TARGET_TARGETNAME}>\"\;\#1 | |
COMMENT "Adding display aware manifest..." | |
) | |
ENDIF() | |
ENDIF(MSVC) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
If you are amending manifests to DLL-files you will need to change the
#1
to#2
in on the following line:http://gist.github.com/bjornblissing/6fc452fe7ec1fdfe3419#file-cmakemanifest-txt-L9
So the new line would be:
COMMAND "mt.exe" -manifest \"${CMAKE_CURRENT_SOURCE_DIR}\\dpiawarescaleing.manifest\" -inputresource:\"$<TARGET_FILE:${TARGET_TARGETNAME}>\"\;\#2 -outputresource:\"$<TARGET_FILE:${TARGET_TARGETNAME}>\"\;\#2