diff --git a/build/cmake/functions.cmake b/build/cmake/functions.cmake index d422cdb162..b7d5a9af6b 100644 --- a/build/cmake/functions.cmake +++ b/build/cmake/functions.cmake @@ -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() diff --git a/samples/minimal/CMakeLists.txt b/samples/minimal/CMakeLists.txt index a68272f763..81abbe9668 100644 --- a/samples/minimal/CMakeLists.txt +++ b/samples/minimal/CMakeLists.txt @@ -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