[Release] Webkit-EFL Ver. 2.0_beta_118996_0.6.22
[framework/web/webkit-efl.git] / Source / cmake / FindSqlite.cmake
1 # - Try to find Sqlite
2 # Once done this will define
3 #
4 #  SQLITE_FOUND - system has Sqlite
5 #  SQLITE_INCLUDE_DIR - the Sqlite include directory
6 #  SQLITE_LIBRARIES - Link these to use Sqlite
7 #  SQLITE_DEFINITIONS - Compiler switches required for using Sqlite
8 #
9 # Copyright (c) 2008, Gilles Caulier, <caulier.gilles@gmail.com>
10 #
11 # Redistribution and use in source and binary forms, with or without
12 # modification, are permitted provided that the following conditions
13 # are met:
14 #
15 # 1. Redistributions of source code must retain the copyright
16 #    notice, this list of conditions and the following disclaimer.
17 # 2. Redistributions in binary form must reproduce the copyright
18 #    notice, this list of conditions and the following disclaimer in the
19 #    documentation and/or other materials provided with the distribution.
20 # 3. The name of the author may not be used to endorse or promote products
21 #    derived from this software without specific prior written permission.
22 #
23 # THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
24 # IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
25 # OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
26 # IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
27 # INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
28 # NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
29 # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
30 # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
31 # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
32 # THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
33
34 if ( SQLITE_INCLUDE_DIR AND SQLITE_LIBRARIES )
35    # in cache already
36    SET(Sqlite_FIND_QUIETLY TRUE)
37 endif ( SQLITE_INCLUDE_DIR AND SQLITE_LIBRARIES )
38
39 # use pkg-config to get the directories and then use these values
40 # in the FIND_PATH() and FIND_LIBRARY() calls
41 if( NOT WIN32 )
42   find_package(PkgConfig)
43
44   pkg_check_modules(PC_SQLITE sqlite3)
45
46   set(SQLITE_DEFINITIONS ${PC_SQLITE_CFLAGS_OTHER})
47 endif( NOT WIN32 )
48
49 FIND_PATH(SQLITE_INCLUDE_DIR NAMES sqlite3.h
50   PATHS
51   ${PC_SQLITE_INCLUDEDIR}
52   ${PC_SQLITE_INCLUDE_DIRS}
53 )
54
55 FIND_LIBRARY(SQLITE_LIBRARIES NAMES sqlite3
56   PATHS
57   ${PC_SQLITE_LIBDIR}
58   ${PC_SQLITE_LIBRARY_DIRS}
59 )
60
61 include(FindPackageHandleStandardArgs)
62 FIND_PACKAGE_HANDLE_STANDARD_ARGS(Sqlite DEFAULT_MSG SQLITE_INCLUDE_DIR SQLITE_LIBRARIES )
63
64 # show the SQLITE_INCLUDE_DIR and SQLITE_LIBRARIES variables only in the advanced view
65 MARK_AS_ADVANCED(SQLITE_INCLUDE_DIR SQLITE_LIBRARIES )
66