Make Windows icon optional

This commit is contained in:
Martchus 2016-11-19 22:33:03 +01:00
parent 9c97d8722d
commit ade4565e0c
1 changed files with 31 additions and 26 deletions

View File

@ -4,7 +4,10 @@
# before including this module, LibraryConfig/ApplicationConfig must be included # before including this module, LibraryConfig/ApplicationConfig must be included
if(MINGW) option(WINDOWS_RESOURCES_ENABLED "controls Windows resources are enabled" ON)
option(WINDOWS_ICON_ENABLED "controls Windows icon is enabled" ON)
if(MINGW AND WINDOWS_RESOURCES_ENABLED)
# find rc template # find rc template
include(TemplateFinder) include(TemplateFinder)
find_template_file("windows.rc" CPP_UTILITIES RC_TEMPLATE_FILE) find_template_file("windows.rc" CPP_UTILITIES RC_TEMPLATE_FILE)
@ -12,6 +15,7 @@ if(MINGW)
# create Windows icon from png with ffmpeg if available # create Windows icon from png with ffmpeg if available
unset(WINDOWS_ICON_PATH) unset(WINDOWS_ICON_PATH)
unset(WINDOWS_ICON_RC_ENTRY) unset(WINDOWS_ICON_RC_ENTRY)
if(WINDOWS_ICON_ENABLED)
find_program(FFMPEG_BIN ffmpeg avconv) find_program(FFMPEG_BIN ffmpeg avconv)
if(FFMPEG_BIN) if(FFMPEG_BIN)
if(NOT PNG_ICON_PATH) if(NOT PNG_ICON_PATH)
@ -37,6 +41,7 @@ if(MINGW)
endif() endif()
unset(USING_DEFAULT_PNG_ICON_PATH) unset(USING_DEFAULT_PNG_ICON_PATH)
endif(FFMPEG_BIN) endif(FFMPEG_BIN)
endif()
# create Windows rc file from template # create Windows rc file from template
configure_file( configure_file(
@ -48,4 +53,4 @@ if(MINGW)
set(CMAKE_RC_COMPILER_INIT windres) set(CMAKE_RC_COMPILER_INIT windres)
set(CMAKE_RC_COMPILE_OBJECT "<CMAKE_RC_COMPILER> <FLAGS> -O coff <DEFINES> -i <SOURCE> -o <OBJECT>") set(CMAKE_RC_COMPILE_OBJECT "<CMAKE_RC_COMPILER> <FLAGS> -O coff <DEFINES> -i <SOURCE> -o <OBJECT>")
enable_language(RC) enable_language(RC)
endif(MINGW) endif()