Fix CMake build issues after enabling manifest from rc file

This commit is contained in:
Maarten Bent 2023-08-24 15:53:00 +02:00
parent 10d09ec2b2
commit 026528f861
No known key found for this signature in database
GPG key ID: 58AAEE3F4A4FD070
2 changed files with 10 additions and 3 deletions

View file

@ -801,7 +801,11 @@ function(wx_add name group)
add_executable(${target_name} ${exe_type} ${src_files})
if (DEFINED wxUSE_DPI_AWARE_MANIFEST_VALUE)
set_target_properties(${target_name} PROPERTIES LINK_FLAGS "/MANIFEST:NO")
if(MSVC)
# Manifest is included via .rc file.
# Disable the default manifest added by CMake to prevent dupicate manifest error.
set_target_properties(${target_name} PROPERTIES LINK_FLAGS "/MANIFEST:NO")
endif()
target_compile_definitions(${target_name} PRIVATE wxUSE_DPI_AWARE_MANIFEST=${wxUSE_DPI_AWARE_MANIFEST_VALUE})
endif()
endif()

View file

@ -46,7 +46,7 @@ set(SRC_FILES
)
if(WIN32)
# Include a RC file for windows
# Include a RC file for windows, for icon and manifest
list(APPEND SRC_FILES ../sample.rc)
elseif(APPLE)
# Add an icon for the apple .app file
@ -58,7 +58,10 @@ add_executable(${PROJECT_NAME} WIN32 MACOSX_BUNDLE ${SRC_FILES})
# Link required libraries to the executable
target_link_libraries(${PROJECT_NAME} ${wxWidgets_LIBRARIES})
if(APPLE)
if(MSVC)
# Prevent duplicate manifest, it is already added via sample.rc
set_target_properties(${PROJECT_NAME} PROPERTIES LINK_FLAGS "/MANIFEST:NO")
elseif(APPLE)
set_target_properties(${PROJECT_NAME} PROPERTIES
RESOURCE "../../src/osx/carbon/wxmac.icns"
MACOSX_BUNDLE_ICON_FILE wxmac.icns