| --- a/CMakeLists.txt |
| +++ b/CMakeLists.txt |
| @@ -617,7 +617,7 @@ if ( APPLE ) |
| add_definitions( -mmacosx-version-min=10.8 ) |
| endif() |
| |
| -if(APPLE) |
| +if(NOT SQLITE3_FOUND) |
| # On Linux, we use the distro's libsqlite3 |
| add_subdirectory(sqlite3) |
| endif() |
| @@ -715,6 +715,9 @@ if(APPLE) |
| if ( USE_PCH ) |
| add_dependencies(sqlite3lib ${CL_PCH_TARGET}) |
| endif ( USE_PCH ) |
| +endif() |
| + |
| +if(NOT SQLITE3_FOUND) |
| add_dependencies(wxsqlite3 sqlite3lib) |
| endif() |
| |
| --- a/CodeLite/CMakeLists.txt |
| +++ b/CodeLite/CMakeLists.txt |
| @@ -112,7 +112,7 @@ FILE(GLOB SRCS "*.cpp" "../sdk/codelite_indexer/network/*.cpp" "SocketAPI/*.cpp" |
| |
| # Define the output |
| add_library(libcodelite SHARED ${SRCS}) |
| -if (UNIX AND NOT APPLE ) |
| +if (UNIX AND NOT APPLE OR MINGW ) |
| target_link_libraries(libcodelite |
| ${LINKER_OPTIONS} |
| ${wxWidgets_LIBRARIES} |
| @@ -122,7 +122,7 @@ if (UNIX AND NOT APPLE ) |
| ${LIBSSH_LIB} |
| ${ADDITIONAL_LIBRARIES} |
| ${LIBUCHARDET_LIB}) |
| -else (UNIX AND NOT APPLE) |
| +else (UNIX AND NOT APPLE OR MINGW) |
| target_link_libraries(libcodelite |
| ${LINKER_OPTIONS} |
| ${wxWidgets_LIBRARIES} |
| --- a/cmake/Modules/FindSqlite3.cmake |
| +++ b/cmake/Modules/FindSqlite3.cmake |
| @@ -1,27 +1,76 @@ |
| -if(UNIX AND NOT APPLE) |
| +# Try to find Sqlite3 |
| +# Once done this will define |
| +# |
| +# SQLITE3_FOUND - system has Sqlite3 |
| +# SQLITE3_INCLUDE_DIRS - the Sqlite3 include directory |
| +# SQLITE3_LIBRARIES - Link these to use Sqlite3 |
| +# SQLITE3_DEFINITIONS - Compiler switches required for using Sqlite3 |
| +# |
| + |
| +if(NOT APPLE) |
| + if (SQLITE3_LIBRARIES AND SQLITE3_INCLUDE_DIRS) |
| + # in cache already |
| + set(SQLITE3_FOUND TRUE) |
| + else() |
| + # use pkg-config to get the directories and then use these values |
| + # in the FIND_PATH() and FIND_LIBRARY() calls |
| + find_package(PkgConfig) |
| + if(PKG_CONFIG_FOUND) |
| + pkg_check_modules(_SQLITE3 sqlite3) |
| + endif() |
| + find_path(SQLITE3_INCLUDE_DIR |
| + NAMES |
| + sqlite3.h |
| + HINTS |
| + ${_SQLITE3_INCLUDE_DIRS} |
| + $ENV{SQLITE3DIR}/include |
| + /usr/include |
| + /usr/include/sqlite3 |
| + /usr/local/include |
| + /opt/local/include |
| + ) |
| + |
| find_library(SQLITE3_LIBRARY |
| - NAMES libsqlite3.so |
| - HINTS |
| - /usr/local/lib |
| - /usr/lib |
| - /usr/lib/x86_64-linux-gnu |
| - /usr/lib/i386-linux-gnu |
| - ) |
| - |
| - find_path(SQLITE3_INCLUDE_DIR NAMES sqlite3.h |
| - HINTS |
| - /usr/local/include |
| - /usr/include |
| - /usr/include/sqlite3 |
| - ) |
| - if (SQLITE3_INCLUDE_DIR AND SQLITE3_LIBRARY) |
| + NAMES |
| + sqlite3 |
| + HINTS |
| + ${_SQLITE3_LIBRARY_DIRS} |
| + $ENV{SQLITE3DIR}/lib |
| + /usr/lib |
| + /usr/lib/x86_64-linux-gnu |
| + /usr/lib/i386-linux-gnu |
| + /usr/local/lib |
| + /opt/local/lib |
| + ) |
| + |
| + if(SQLITE3_LIBRARY) |
| + set(SQLITE3_FOUND TRUE) |
| + endif() |
| + |
| + set(SQLITE3_INCLUDE_DIRS |
| + ${SQLITE3_INCLUDE_DIR} |
| + ) |
| + |
| + if(SQLITE3_FOUND) |
| + set(SQLITE3_LIBRARIES |
| + ${SQLITE3_LIBRARIES} |
| + ${SQLITE3_LIBRARY} |
| + ) |
| + endif() |
| + |
| + if(SQLITE3_INCLUDE_DIRS AND SQLITE3_LIBRARIES) |
| set(SQLITE3_FOUND TRUE) |
| endif() |
| - |
| - if(NOT SQLITE3_FOUND) |
| - message(FATAL_ERROR " **** Could not find Sqlite3. Please install libsqlite3-dev package **** ") |
| + |
| + if(SQLITE3_FOUND) |
| + message("-- SQLITE3_INCLUDE_DIR: " ${SQLITE3_INCLUDE_DIR}) |
| + message("-- SQLITE3_LIBRARY: " ${SQLITE3_LIBRARY}) |
| else() |
| - message("-- SQLITE3_INCLUDE_DIR: " ${SQLITE3_INCLUDE_DIR}) |
| - message("-- SQLITE3_LIBRARY: " ${SQLITE3_LIBRARY}) |
| + message(-- "Could not find system Sqlite3. Using bundled sqlite3") |
| endif() |
| + |
| + # show the SQLITE3_INCLUDE_DIRS and SQLITE3_LIBRARIES variables only in the advanced view |
| + mark_as_advanced(SQLITE3_INCLUDE_DIRS SQLITE3_LIBRARIES) |
| + |
| + endif () |
| endif() |
| --- a/sdk/databaselayer/CMakeLists.txt |
| +++ b/sdk/databaselayer/CMakeLists.txt |
| @@ -12,7 +12,7 @@ project(databaselayersqlite) |
| include( "${wxWidgets_USE_FILE}" ) |
| |
| # Include paths |
| -include_directories(./include/wx/dblayer/include src/sqlite3) |
| +include_directories(./include/wx/dblayer/include ${SQLITE3_INCLUDE_DIR}) |
| |
| if ( USE_PCH ) |
| set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -include ${CL_PCH_FILE} -Winvalid-pch ") |
| @@ -72,7 +72,7 @@ endif ( WITH_MYSQL ) |
| |
| # Define the output |
| add_library(databaselayersqlite SHARED ${SRCS} ${MYSQL_SRCS}) |
| -target_link_libraries(databaselayersqlite ${LINKER_OPTIONS} ${wxWidgets_LIBRARIES}) |
| +target_link_libraries(databaselayersqlite ${LINKER_OPTIONS} ${wxWidgets_LIBRARIES} -L"${CL_LIBPATH}" ${SQLITE3_LIBRARY}) |
| |
| if(APPLE) |
| install(TARGETS databaselayersqlite DESTINATION ${CMAKE_BINARY_DIR}/codelite.app/Contents/MacOS/) |
| -- |