Debian Codegraph @

cmake/Findsqlite3.cmake

raw
1 # Copyright 2022 Timo Röhling <[email protected]>
2 # SPDX-License-Identifier: FSFAP
3 #
4 # Copying and distribution of this file, with or without modification, are
5 # permitted in any medium without royalty provided the copyright notice and
6 # this notice are preserved. This file is offered as-is, without any warranty.
7 #
8 include(FindPackageHandleStandardArgs)
9 find_package(PkgConfig QUIET)
10 if(PkgConfig_FOUND)
11 pkg_search_module(PC_SQLITE3 QUIET sqlite3)
12 endif()
13 find_path(sqlite3_INCLUDE_DIR sqlite3.h HINTS ${PC_SQLITE3_INCLUDE_DIRS})
14 find_library(sqlite3_LIBRARY sqlite3 HINTS ${PC_SQLITE3_LIBRARY_DIRS})
15 find_package_handle_standard_args(
16 sqlite3
17 FOUND_VAR sqlite3_FOUND
18 REQUIRED_VARS sqlite3_INCLUDE_DIR sqlite3_LIBRARY
19 )
20 if(sqlite3_FOUND AND NOT TARGET sqlite3::sqlite3)
21 add_library(sqlite3::sqlite3 UNKNOWN IMPORTED)
22 set_target_properties(
23 sqlite3::sqlite3
24 PROPERTIES IMPORTED_LOCATION "${sqlite3_LIBRARY}"
25 INTERFACE_INCLUDE_DIRECTORIES "${sqlite3_INCLUDE_DIR}"
26 )
27 endif()