From 99868323d703d8658ab5218af5233af4cc013b35 Mon Sep 17 00:00:00 2001 From: Jonas Kvinge Date: Fri, 4 May 2018 19:16:08 +0200 Subject: [PATCH] Fix compile without built-in qsqlite --- CMakeLists.txt | 4 +++- src/CMakeLists.txt | 7 +------ src/config.h.in | 1 + src/core/main.cpp | 2 ++ 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 31cc61d22..ee24564ac 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -282,14 +282,16 @@ list(REMOVE_ITEM QT_LIBRARIES "-lGLU -lGL") # QSqlLiteDriver: # We do this because we can't guarantee that the driver shipped with Qt exposes the raw sqlite3 functions required for FTS support. # This way we know that those symbols exist at compile-time and that our code links to the same sqlite library as the Qt driver. -option(USE_SYSTEM_QSQLITE "Don't set this unless you can guarantee that the driver shipped with Qt exposes the raw sqlite3 functions required for FTS support" OFF) +option(USE_SYSTEM_QSQLITE "Don't set this unless you can guarantee that the driver shipped with Qt exposes the raw sqlite3 functions required for FTS support" ON) if(USE_SYSTEM_QSQLITE) message(STATUS "Using system qsqlite driver") + set(USE_SYSTEM_QSQLITE ON) else(USE_SYSTEM_QSQLITE) message(STATUS "Using builtin qsqlite driver") add_subdirectory(3rdparty/qsqlite) set(QSQLITE_LIBRARIES qsqlite) set(QSQLITE_INCLUDE_DIRS "3rdparty/qsqlite") + set(USE_SYSTEM_QSQLITE OFF) endif(USE_SYSTEM_QSQLITE) # When/if upstream accepts our patches then these options can be used to link to system installed qtsingleapplication instead. diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 343fa1efa..0bbd1c76b 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -853,6 +853,7 @@ target_link_libraries(strawberry_lib ${QTSINGLEAPPLICATION_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT} ${SQLITE_LIBRARIES} + ${QSQLITE_LIBRARIES} z Qocoa ) @@ -891,10 +892,6 @@ if(HAVE_LIBMTP) target_link_libraries(strawberry_lib ${LIBMTP_LIBRARIES}) endif(HAVE_LIBMTP) -#if(HAVE_LIBINDICATE) -# target_link_libraries(strawberry_lib ${INDICATEQT_LIBRARIES}) -#endif(HAVE_LIBINDICATE) - if(HAVE_LIBPULSE) target_link_libraries(strawberry_lib ${LIBPULSE_LIBRARIES}) endif() @@ -918,8 +915,6 @@ else (APPLE) target_link_libraries(strawberry_lib ${QXT_LIBRARIES}) endif (APPLE) -target_link_libraries(strawberry_lib qsqlite) - if (WIN32) target_link_libraries(strawberry_lib ${ZLIB_LIBRARIES} diff --git a/src/config.h.in b/src/config.h.in index 56bd0e60c..5d0538a5a 100644 --- a/src/config.h.in +++ b/src/config.h.in @@ -38,6 +38,7 @@ #cmakedefine TAGLIB_HAS_OPUS #cmakedefine USE_INSTALL_PREFIX #cmakedefine USE_SYSTEM_SHA2 +#cmakedefine USE_SYSTEM_QSQLITE #cmakedefine HAVE_GSTREAMER #cmakedefine HAVE_VLC diff --git a/src/core/main.cpp b/src/core/main.cpp index def884742..0c7a67628 100644 --- a/src/core/main.cpp +++ b/src/core/main.cpp @@ -82,8 +82,10 @@ #endif // Load sqlite plugin on windows and mac. +#ifndef USE_SYSTEM_QSQLITE #include Q_IMPORT_PLUGIN(QSQLiteDriverPlugin) +#endif int main(int argc, char* argv[]) {