Skip to content
This repository has been archived by the owner on Oct 10, 2021. It is now read-only.

Commit

Permalink
Fix Windows linker and runtime errors when building against static Qt
Browse files Browse the repository at this point in the history
  • Loading branch information
phoerious committed Jan 26, 2017
1 parent 1310b34 commit 292ed89
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 0 deletions.
9 changes: 9 additions & 0 deletions cmake/FindLibGPGError.cmake
Original file line number Diff line number Diff line change
@@ -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)
1 change: 1 addition & 0 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
10 changes: 10 additions & 0 deletions src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ set(TEST_LIBRARIES
Qt5::Widgets
Qt5::Test
${GCRYPT_LIBRARIES}
${GPGERROR_LIBRARIES}
${ZLIB_LIBRARIES}
)

Expand Down
2 changes: 2 additions & 0 deletions utils/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,15 @@ target_link_libraries(kdbx-extract
keepassx_core
Qt5::Core
${GCRYPT_LIBRARIES}
${GPGERROR_LIBRARIES}
${ZLIB_LIBRARIES})

add_executable(kdbx-merge kdbx-merge.cpp)
target_link_libraries(kdbx-merge
keepassx_core
Qt5::Core
${GCRYPT_LIBRARIES}
${GPGERROR_LIBRARIES}
${ZLIB_LIBRARIES})


Expand Down

0 comments on commit 292ed89

Please sign in to comment.