FindSqlite3.cmake 1.79 KB
Newer Older
1
############################################################################
johan's avatar
johan committed
2 3
# FindSqlite3.cmake
# Copyright (C) 2014  Belledonne Communications, Grenoble France
4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
#
############################################################################
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
19
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
20 21 22
#
############################################################################
#
johan's avatar
johan committed
23
# - Find the sqlite3 include file and library
24
#
johan's avatar
johan committed
25 26 27
#  SQLITE3_FOUND - system has sqlite3
#  SQLITE3_INCLUDE_DIRS - the sqlite3 include directory
#  SQLITE3_LIBRARIES - The libraries needed to use sqlite3
28

29
if(APPLE AND NOT IOS)
johan's avatar
johan committed
30
	set(SQLITE3_HINTS "/usr")
31
endif()
johan's avatar
johan committed
32 33
if(SQLITE3_HINTS)
	set(SQLITE3_LIBRARIES_HINTS "${SQLITE3_HINTS}/lib")
34
endif()
35

johan's avatar
johan committed
36 37 38 39
find_path(SQLITE3_INCLUDE_DIRS
	NAMES sqlite3.h
	HINTS "${SQLITE3_HINTS}"
	PATH_SUFFIXES include
40 41
)

johan's avatar
johan committed
42 43
if(SQLITE3_INCLUDE_DIRS)
	set(HAVE_SQLITE3_H 1)
44 45
endif()

johan's avatar
johan committed
46 47 48
find_library(SQLITE3_LIBRARIES
	NAMES sqlite3
	HINTS "${SQLITE3_LIBRARIES_HINTS}"
49 50 51
)

include(FindPackageHandleStandardArgs)
johan's avatar
johan committed
52
find_package_handle_standard_args(Sqlite3
53
	DEFAULT_MSG
johan's avatar
johan committed
54
	SQLITE3_INCLUDE_DIRS SQLITE3_LIBRARIES HAVE_SQLITE3_H
55 56
)

johan's avatar
johan committed
57
mark_as_advanced(SQLITE3_INCLUDE_DIRS SQLITE3_LIBRARIES HAVE_SQLITE3_H)