Remove FindSQLiteCpp.cmake

It's not needed since the automatically generated file
SQLiteCppConfig.cmake already exists.

Added a small section to the README to explain how it can be used when
this library is installed to the system.

Fixes #283
This commit is contained in:
sum01 2020-08-18 12:07:26 -04:00
parent cc2e488d1a
commit 72c4983056
No known key found for this signature in database
GPG Key ID: 339CB8BE119B90C0
3 changed files with 14 additions and 64 deletions

View File

@ -165,7 +165,6 @@ set(SQLITECPP_SCRIPT
build.sh
cpplint.py
Doxyfile
cmake/FindSQLiteCpp.cmake
cmake/FindSQLite3.cmake
cmake/SQLiteCppConfig.cmake.in
)

View File

@ -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.

View File

@ -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)