diff --git a/CMakeLists.txt b/CMakeLists.txt index e8655b24c..9e4498a69 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -136,6 +136,9 @@ macro_log_feature(QTWEETLIB_FOUND "QTweetLib" "Qt Twitter Library" "https://gith macro_optional_find_package(LibLastFm 1.0.0) macro_log_feature(LIBLASTFM_FOUND "liblastfm" "Qt library for the Last.fm webservices" "https://github.com/eartle/liblastfm" TRUE "" "liblastfm is needed for scrobbling tracks to Last.fm and fetching cover artwork") +macro_optional_find_package(Sqlite) +macro_log_feature(SQLITE_FOUND "SQLite" "Provides a SQL database in a C library" "http://www.sqlite.org" TRUE "" "sqlite is needed for our forked QSQLite driver, since 4.8.2 screws it up") + #### submodules start # automatically init submodules here, don't delete this code we may add submodules again diff --git a/CMakeModules/FindSqlite.cmake b/CMakeModules/FindSqlite.cmake new file mode 100644 index 000000000..c4f2e90a6 --- /dev/null +++ b/CMakeModules/FindSqlite.cmake @@ -0,0 +1,50 @@ +# - Try to find Sqlite +# Once done this will define +# +# SQLITE_FOUND - system has Sqlite +# SQLITE_INCLUDE_DIR - the Sqlite include directory +# SQLITE_LIBRARIES - Link these to use Sqlite +# SQLITE_DEFINITIONS - Compiler switches required for using Sqlite +# Redistribution and use is allowed according to the terms of the BSD license. +# For details see the accompanying COPYING-CMAKE-SCRIPTS file. +# + + +# Copyright (c) 2008, Gilles Caulier, +# +# Redistribution and use is allowed according to the terms of the BSD license. +# For details see the accompanying COPYING-CMAKE-SCRIPTS file. + +if ( SQLITE_INCLUDE_DIR AND SQLITE_LIBRARIES ) + # in cache already + SET(Sqlite_FIND_QUIETLY TRUE) +endif ( SQLITE_INCLUDE_DIR AND SQLITE_LIBRARIES ) + +# use pkg-config to get the directories and then use these values +# in the FIND_PATH() and FIND_LIBRARY() calls +if( NOT WIN32 ) + find_package(PkgConfig) + + pkg_check_modules(PC_SQLITE QUIET sqlite3) + + set(SQLITE_DEFINITIONS ${PC_SQLITE_CFLAGS_OTHER}) +endif( NOT WIN32 ) + +find_path(SQLITE_INCLUDE_DIR NAMES sqlite3.h + PATHS + ${PC_SQLITE_INCLUDEDIR} + ${PC_SQLITE_INCLUDE_DIRS} +) + +find_library(SQLITE_LIBRARIES NAMES sqlite3 + PATHS + ${PC_SQLITE_LIBDIR} + ${PC_SQLITE_LIBRARY_DIRS} +) + +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args(Sqlite DEFAULT_MSG SQLITE_INCLUDE_DIR SQLITE_LIBRARIES ) + +# show the SQLITE_INCLUDE_DIR and SQLITE_LIBRARIES variables only in the advanced view +mark_as_advanced(SQLITE_INCLUDE_DIR SQLITE_LIBRARIES ) + diff --git a/src/libtomahawk/CMakeLists.txt b/src/libtomahawk/CMakeLists.txt index c000649fd..fc42ea208 100644 --- a/src/libtomahawk/CMakeLists.txt +++ b/src/libtomahawk/CMakeLists.txt @@ -336,6 +336,7 @@ include_directories( . ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_BINARY_DIR}/. ${LIBLASTFM_INCLUDE_DIRS}/.. ${CLUCENE_INCLUDE_DIRS} ${PHONON_INCLUDES} + ${SQLITE_INCLUDE_DIR} playlist @@ -437,8 +438,6 @@ TARGET_LINK_LIBRARIES( tomahawklib # Thirdparty shipped with tomahawk ${LIBPORTFWD_LIBRARIES} - sqlite3 - # External deps ${QJSON_LIBRARIES} ${PHONON_LIBS} @@ -457,6 +456,7 @@ TARGET_LINK_LIBRARIES( tomahawklib ${CMAKE_THREAD_LIBS_INIT} ${LINK_LIBRARIES} ${Boost_LIBRARIES} + ${SQLITE_LIBRARIES} ) INSTALL( TARGETS tomahawklib