Build icon into the main executable on Windows.

This commit is contained in:
Felix Geyer 2012-10-23 14:52:59 +02:00
parent 7d57d08b32
commit 34f595cc78
3 changed files with 18 additions and 1 deletions

View File

@ -123,6 +123,12 @@ else()
add_gcc_compiler_flags("-ansi")
endif()
if(MINGW)
set(CMAKE_RC_COMPILER_INIT windres)
enable_language(RC)
set(CMAKE_RC_COMPILE_OBJECT "<CMAKE_RC_COMPILER> <FLAGS> -O coff <DEFINES> -i <SOURCE> -o <OBJECT>")
endif()
if(APPLE OR MINGW)
set(PROGNAME KeePassX)
else()

1
share/windows/icon.rc Normal file
View File

@ -0,0 +1 @@
IDI_ICON1 ICON DISCARDABLE "keepassx.ico"

View File

@ -105,6 +105,10 @@ set(keepassx_SOURCES
streams/SymmetricCipherStream.cpp
)
set(keepassx_SOURCES_MAINEXE
main.cpp
)
set(keepassx_MOC
autotype/AutoType.h
autotype/AutoTypeSelectDialog.h
@ -179,12 +183,18 @@ set(keepassx_FORMS
gui/group/EditGroupWidgetMain.ui
)
if(MINGW)
set(keepassx_SOURCES_MAINEXE
${keepassx_SOURCES_MAINEXE}
${CMAKE_SOURCE_DIR}/share/windows/icon.rc)
endif()
qt4_wrap_ui(keepassx_SOURCES ${keepassx_FORMS})
qt4_wrap_cpp(keepassx_SOURCES ${keepassx_MOC})
add_library(keepassx_core STATIC ${keepassx_SOURCES})
add_executable(${PROGNAME} WIN32 MACOSX_BUNDLE main.cpp)
add_executable(${PROGNAME} WIN32 MACOSX_BUNDLE ${keepassx_SOURCES_MAINEXE})
target_link_libraries(${PROGNAME}
keepassx_core
${QT_QTCORE_LIBRARY}