diff --git a/CMakeLists.txt b/CMakeLists.txt index 2d80cb4a..bc552d24 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -165,7 +165,6 @@ set(SQLITECPP_SCRIPT build.sh cpplint.py Doxyfile - cmake/FindSQLiteCpp.cmake cmake/FindSQLite3.cmake cmake/SQLiteCppConfig.cmake.in ) diff --git a/README.md b/README.md index a4d9c88a..8304f62d 100644 --- a/README.md +++ b/README.md @@ -131,6 +131,20 @@ git submodule init git submodule update ``` +#### Using SQLiteCpp on a system-wide installation + +If you installed this package to your system, a `SQLiteCppConfig.cmake` file will be generated & installed to your system. +This file lets you link against the SQLiteCpp library for use in your Cmake project. + +Here's an example of using this in your CMakeLists.txt +```cmake +# You can optionally define a minimum version in this call +find_package(SQLiteCpp REQUIRED) +# For this example, lets say you created an target with add_executable (or add_library) called "my_target" +# You can optionally declare PUBLIC or PRIVATE linkage here, depending on your needs. +target_link_libraries(my_target PRIVATE SQLiteCpp) +``` + #### CMake and tests A CMake configuration file is also provided for multi-platform support and testing. diff --git a/cmake/FindSQLiteCpp.cmake b/cmake/FindSQLiteCpp.cmake deleted file mode 100644 index 71114ca4..00000000 --- a/cmake/FindSQLiteCpp.cmake +++ /dev/null @@ -1,63 +0,0 @@ -# @file CMakeLists.txt -# @ingroup SQLiteCpp -# @brief SQLiteCpp CMake module. -# -# Distributed under the MIT License (MIT) (See accompanying file LICENSE.txt -# or copy at http://opensource.org/licenses/MIT) - -macro(_sqlitecpp_check_version) - file(READ "${SQLITECPP_INCLUDE_DIR}/SQLiteCpp.h" _sqlitecpp_header) - - string(REGEX MATCH "define[ \t]+SQLITECPP_VERSION_NUMBER[ \t]+([0-9]+)" - _sqlitecpp_version_match "${_sqlitecpp_header}") - set(SQLITECPP_VERSION "${CMAKE_MATCH_1}") - - if(SQLiteCpp_FIND_VERSION) - if(${SQLITECPP_VERSION} VERSION_LESS ${SQLiteCpp_FIND_VERSION}) - set(SQLITECPP_VERSION_OK FALSE) - else(${SQLITECPP_VERSION} VERSION_LESS ${SQLiteCpp_FIND_VERSION}) - set(SQLITECPP_VERSION_OK TRUE) - endif(${SQLITECPP_VERSION} VERSION_LESS ${SQLiteCpp_FIND_VERSION}) - - if(NOT SQLITECPP_VERSION_OK) - message(STATUS "SQLiteCpp version ${SQLITECPP_VERSION} found in ${SQLITECPP_INCLUDE_DIR}, " - "but at least version ${SQLiteCpp_FIND_VERSION} is required!") - endif(NOT SQLITECPP_VERSION_OK) - else(SQLiteCpp_FIND_VERSION) - if(SQLITECPP_VERSION) - set(SQLITECPP_VERSION_OK TRUE) - endif(SQLITECPP_VERSION) - endif(SQLiteCpp_FIND_VERSION) - - set(SQLITECPP_LIBRARY "SQLiteCpp") - link_directories(${SQLITECPP_LIBRARY_DIR}) -endmacro(_sqlitecpp_check_version) - -if(SQLITECPP_INCLUDE_DIR) - # Check if SQLiteCpp is already present in cache. - _sqlitecpp_check_version() - set(SQLITECPP_FOUND ${SQLITECPP_VERSION_OK}) - -else (SQLITECPP_INCLUDE_DIR) - find_path(SQLITECPP_BASE_PATH NAMES SQLiteCpp.h - PATHS - ${PROJECT_SOURCE_DIR} - ${PROJECT_SOURCE_DIR}/.. - ${PROJECT_SOURCE_DIR}/../.. - ${PROJECT_SOURCE_DIR}/../../.. - ${PROJECT_SOURCE_DIR}/../../../.. - PATH_SUFFIXES SQLiteCpp/include/SQLiteCpp - ) - set(SQLITECPP_INCLUDE_DIR ${SQLITECPP_BASE_PATH}) - set(SQLITECPP_LIBRARY_DIR ${SQLITECPP_BASE_PATH}/../../build) - - if(SQLITECPP_INCLUDE_DIR) - _sqlitecpp_check_version() - endif(SQLITECPP_INCLUDE_DIR) - - include(FindPackageHandleStandardArgs) - find_package_handle_standard_args(SQLITECPP DEFAULT_MSG SQLITECPP_INCLUDE_DIR SQLITECPP_VERSION_OK) - - mark_as_advanced(SQLITECPP_INCLUDE_DIR) - -endif(SQLITECPP_INCLUDE_DIR)