diff --git a/CMakeLists.txt b/CMakeLists.txt index 0c7840b..7454784 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -98,14 +98,14 @@ set(CMAKE_TEMPLATE_FILES cmake/templates/template.pc.in) set(SCRIPT_FILES) if (MINGW) - list(APPEND CMAKE_TEMPLATE_FILES - cmake/templates/windows.rc.in - cmake/templates/windows-cli-wrapper.rc.in - ) list(APPEND SCRIPT_FILES scripts/wine.sh) endif () if (WIN32) - list(APPEND CMAKE_TEMPLATE_FILES cmake/templates/cli-wrapper.cpp) + list(APPEND CMAKE_TEMPLATE_FILES + cmake/templates/windows.rc.in + cmake/templates/windows-cli-wrapper.rc.in + cmake/templates/cli-wrapper.cpp + ) endif () set(EXCLUDED_FILES cmake/templates/cli-wrapper.cpp) diff --git a/cmake/modules/WindowsResources.cmake b/cmake/modules/WindowsResources.cmake index 0626df4..14b34ad 100644 --- a/cmake/modules/WindowsResources.cmake +++ b/cmake/modules/WindowsResources.cmake @@ -12,7 +12,7 @@ endif () option(WINDOWS_RESOURCES_ENABLED "controls whether Windows resources are enabled" ON) option(WINDOWS_ICON_ENABLED "controls whether Windows icon is enabled" ON) -if (NOT MINGW OR NOT WINDOWS_RESOURCES_ENABLED) +if (NOT WIN32 OR NOT WINDOWS_RESOURCES_ENABLED) return() endif () @@ -60,13 +60,17 @@ if (BUILD_CLI_WRAPPER AND META_PROJECT_TYPE STREQUAL "application") INPUT "${WINDOWS_CLI_RC_FILE}-configured.rc") endif () -# set windres as resource compiler +# add resource file to sources list(APPEND RES_FILES "${WINDOWS_RC_FILE}-${CMAKE_BUILD_TYPE}.rc") set_property(SOURCE "${WINDOWS_RC_FILE}-${CMAKE_BUILD_TYPE}.rc" PROPERTY GENERATED ON) if (BUILD_CLI_WRAPPER AND META_PROJECT_TYPE STREQUAL "application") list(APPEND CLI_WRAPPER_RES_FILES "${WINDOWS_CLI_RC_FILE}-${CMAKE_BUILD_TYPE}.rc") set_property(SOURCE "${WINDOWS_CLI_RC_FILE}-${CMAKE_BUILD_TYPE}.rc" PROPERTY GENERATED ON) endif () -set(CMAKE_RC_COMPILER_INIT windres) -set(CMAKE_RC_COMPILE_OBJECT " -O coff -i -o ") + +# configure resource compiler; use windres when compiling with mingw-w64 +if (MINGW) + set(CMAKE_RC_COMPILER_INIT windres) + set(CMAKE_RC_COMPILE_OBJECT " -O coff -i -o ") +endif () enable_language(RC)