Fix Windows linker and runtime errors when building against static Qt

This commit is contained in:
Janek Bevendorff 2017-01-26 01:15:12 +01:00
parent 1310b34e9c
commit 292ed892c1
No known key found for this signature in database
GPG Key ID: CFEC2F6850BFFA53
5 changed files with 23 additions and 0 deletions

View File

@ -0,0 +1,9 @@
find_path(GPGERROR_INCLUDE_DIR gpg-error.h)
find_library(GPGERROR_LIBRARIES gpg-error)
mark_as_advanced(GPGERROR_LIBRARIES GPGERROR_INCLUDE_DIR)
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(LibGPGError DEFAULT_MSG GPGERROR_LIBRARIES GPGERROR_INCLUDE_DIR)

View File

@ -218,6 +218,7 @@ target_link_libraries(${PROGNAME}
Qt5::Widgets
Qt5::Network
${GCRYPT_LIBRARIES}
${GPGERROR_LIBRARIES}
${ZLIB_LIBRARIES})
set_target_properties(${PROGNAME} PROPERTIES ENABLE_EXPORTS ON)

View File

@ -28,6 +28,16 @@
#include "gui/MainWindow.h"
#include "gui/MessageBox.h"
#ifdef QT_STATIC
#include <QtPlugin>
#ifdef Q_OS_WIN
Q_IMPORT_PLUGIN(QWindowsIntegrationPlugin)
#elif Q_OS_LINUX
Q_IMPORT_PLUGIN(QXcbIntegrationPlugin)
#endif
#endif
int main(int argc, char** argv)
{
#ifdef QT_NO_DEBUG

View File

@ -92,6 +92,7 @@ set(TEST_LIBRARIES
Qt5::Widgets
Qt5::Test
${GCRYPT_LIBRARIES}
${GPGERROR_LIBRARIES}
${ZLIB_LIBRARIES}
)

View File

@ -20,6 +20,7 @@ target_link_libraries(kdbx-extract
keepassx_core
Qt5::Core
${GCRYPT_LIBRARIES}
${GPGERROR_LIBRARIES}
${ZLIB_LIBRARIES})
add_executable(kdbx-merge kdbx-merge.cpp)
@ -27,6 +28,7 @@ target_link_libraries(kdbx-merge
keepassx_core
Qt5::Core
${GCRYPT_LIBRARIES}
${GPGERROR_LIBRARIES}
${ZLIB_LIBRARIES})