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") add_gcc_compiler_flags("-ansi")
endif() 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) if(APPLE OR MINGW)
set(PROGNAME KeePassX) set(PROGNAME KeePassX)
else() 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 streams/SymmetricCipherStream.cpp
) )
set(keepassx_SOURCES_MAINEXE
main.cpp
)
set(keepassx_MOC set(keepassx_MOC
autotype/AutoType.h autotype/AutoType.h
autotype/AutoTypeSelectDialog.h autotype/AutoTypeSelectDialog.h
@ -179,12 +183,18 @@ set(keepassx_FORMS
gui/group/EditGroupWidgetMain.ui 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_ui(keepassx_SOURCES ${keepassx_FORMS})
qt4_wrap_cpp(keepassx_SOURCES ${keepassx_MOC}) qt4_wrap_cpp(keepassx_SOURCES ${keepassx_MOC})
add_library(keepassx_core STATIC ${keepassx_SOURCES}) 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} target_link_libraries(${PROGNAME}
keepassx_core keepassx_core
${QT_QTCORE_LIBRARY} ${QT_QTCORE_LIBRARY}