| 1 |
# - Find SQLite3 |
| 2 |
# Find the native SQLite3 includes and libraries |
| 3 |
# |
| 4 |
# SQLite3_INCLUDE_DIRS - where to find sqlite3.h, etc. |
| 5 |
# SQLite3_LIBRARIES - List of libraries when using SQLite3. |
| 6 |
# SQLite3_FOUND - True if SQLite3 found. |
| 7 |
|
| 8 |
if (SQLite3_INCLUDE_DIR) |
| 9 |
# Already in cache, be silent |
| 10 |
set (SQLite3_FIND_QUIETLY TRUE) |
| 11 |
endif () |
| 12 |
|
| 13 |
find_package (PkgConfig QUIET) |
| 14 |
pkg_check_modules (PC_SQLite3 QUIET sqlite3) |
| 15 |
|
| 16 |
set (SQLite3_VERSION ${PC_SQLite3_VERSION}) |
| 17 |
|
| 18 |
find_path (SQLite3_INCLUDE_DIR sqlite3.h |
| 19 |
HINTS |
| 20 |
${PC_SQLite3_INCLUDEDIR} |
| 21 |
${PC_SQLite3_INCLUDE_DIRS} |
| 22 |
${SQLite3_ROOT} |
| 23 |
) |
| 24 |
|
| 25 |
find_library (SQLite3_LIBRARY |
| 26 |
NAMES |
| 27 |
sqlite3 |
| 28 |
HINTS |
| 29 |
${PC_SQLite3_LIBDIR} |
| 30 |
${PC_SQLite3_LIBRARY_DIRS} |
| 31 |
${SQLite3_ROOT} |
| 32 |
) |
| 33 |
|
| 34 |
include (FindPackageHandleStandardArgs) |
| 35 |
|
| 36 |
find_package_handle_standard_args (SQLite3 |
| 37 |
REQUIRED_VARS |
| 38 |
SQLite3_LIBRARY |
| 39 |
SQLite3_INCLUDE_DIR |
| 40 |
VERSION_VAR |
| 41 |
SQLite3_VERSION |
| 42 |
) |
| 43 |
|
| 44 |
if (SQLite3_FOUND) |
| 45 |
set (SQLite3_INCLUDE_DIRS ${SQLite3_INCLUDE_DIR}) |
| 46 |
set (SQLite3_LIBRARIES ${SQLite3_LIBRARY}) |
| 47 |
if (NOT TARGET SQLite::SQLite3) |
| 48 |
add_library (SQLite::SQLite3 UNKNOWN IMPORTED) |
| 49 |
set_target_properties (SQLite::SQLite3 PROPERTIES |
| 50 |
INTERFACE_INCLUDE_DIRECTORIES "${SQLite3_INCLUDE_DIRS}" |
| 51 |
IMPORTED_LOCATION "${SQLite3_LIBRARIES}" |
| 52 |
) |
| 53 |
endif () |
| 54 |
endif () |
| 55 |
|
| 56 |
mark_as_advanced (SQLite3_INCLUDE_DIR SQLite3_LIBRARY) |