File: FindSQLite3.cmake

package info (click to toggle)
libsndfile 1.2.2-4
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 5,180 kB
  • sloc: ansic: 55,354; cpp: 1,108; python: 791; makefile: 545; sh: 538; cs: 122
file content (56 lines) | stat: -rw-r--r-- 1,317 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
# - Find SQLite3
# Find the native SQLite3 includes and libraries
#
#  SQLite3_INCLUDE_DIRS - where to find sqlite3.h, etc.
#  SQLite3_LIBRARIES    - List of libraries when using SQLite3.
#  SQLite3_FOUND        - True if SQLite3 found.

if (SQLite3_INCLUDE_DIR)
	# Already in cache, be silent
	set (SQLite3_FIND_QUIETLY TRUE)
endif ()

find_package (PkgConfig QUIET)
pkg_check_modules (PC_SQLite3 QUIET sqlite3)

set (SQLite3_VERSION ${PC_SQLite3_VERSION})

find_path (SQLite3_INCLUDE_DIR sqlite3.h
	HINTS
		${PC_SQLite3_INCLUDEDIR}
		${PC_SQLite3_INCLUDE_DIRS}
		${SQLite3_ROOT}
	)

find_library (SQLite3_LIBRARY
	NAMES
		sqlite3
	HINTS
		${PC_SQLite3_LIBDIR}
		${PC_SQLite3_LIBRARY_DIRS}
		${SQLite3_ROOT}
	)

include (FindPackageHandleStandardArgs)

find_package_handle_standard_args (SQLite3
	REQUIRED_VARS
		SQLite3_LIBRARY
		SQLite3_INCLUDE_DIR
	VERSION_VAR
		SQLite3_VERSION
	)

if (SQLite3_FOUND)
	set (SQLite3_INCLUDE_DIRS ${SQLite3_INCLUDE_DIR})
	set (SQLite3_LIBRARIES ${SQLite3_LIBRARY})
	if (NOT TARGET SQLite::SQLite3)
		add_library (SQLite::SQLite3 UNKNOWN IMPORTED)
		set_target_properties (SQLite::SQLite3 PROPERTIES
			INTERFACE_INCLUDE_DIRECTORIES "${SQLite3_INCLUDE_DIRS}"
			IMPORTED_LOCATION "${SQLite3_LIBRARIES}"
		)
	endif ()
endif ()

mark_as_advanced (SQLite3_INCLUDE_DIR SQLite3_LIBRARY)