зеркало из https://github.com/nextcloud/desktop.git
Add a new version for the sqlite3 find module.
This commit is contained in:
Родитель
dce6278a1d
Коммит
c08ec25f5b
|
@ -1,82 +1,84 @@
|
|||
# - Try to find sqlite3
|
||||
# Find sqlite3 headers, libraries and the answer to all questions.
|
||||
# - Try to find Sqlite3
|
||||
# Once done this will define
|
||||
#
|
||||
# SQLITE3_FOUND True if sqlite3 got found
|
||||
# SQLITE3_INCLUDEDIR Location of sqlite3 headers
|
||||
# SQLITE3_LIBRARIES List of libaries to use sqlite3
|
||||
# SQLITE3_DEFINITIONS Definitions to compile sqlite3
|
||||
# SQLITE3_FOUND - system has Sqlite3
|
||||
# SQLITE3_INCLUDE_DIRS - the Sqlite3 include directory
|
||||
# SQLITE3_LIBRARIES - Link these to use Sqlite3
|
||||
# SQLITE3_DEFINITIONS - Compiler switches required for using Sqlite3
|
||||
#
|
||||
# Copyright (c) 2007 Juha Tuomala <tuju@iki.fi>
|
||||
# Copyright (c) 2007 Daniel Gollub <dgollub@suse.de>
|
||||
# Copyright (c) 2007 Alban Browaeys <prahal@yahoo.com>
|
||||
# Copyright (c) 2008 Andreas Schneider <mail@cynapses.org>
|
||||
#
|
||||
# Redistribution and use is allowed according to the terms of the New
|
||||
# BSD license.
|
||||
# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
|
||||
#
|
||||
|
||||
INCLUDE( FindPkgConfig )
|
||||
# Take care about sqlite3.pc settings
|
||||
IF ( Sqlite3_FIND_REQUIRED )
|
||||
SET( _pkgconfig_REQUIRED "REQUIRED" )
|
||||
ELSE ( Sqlite3_FIND_REQUIRED )
|
||||
SET( _pkgconfig_REQUIRED "" )
|
||||
ENDIF ( Sqlite3_FIND_REQUIRED )
|
||||
|
||||
IF ( SQLITE3_MIN_VERSION )
|
||||
PKG_SEARCH_MODULE( SQLITE3 ${_pkgconfig_REQUIRED} sqlite3>=${SQLITE3_MIN_VERSION} )
|
||||
ELSE ( SQLITE3_MIN_VERSION )
|
||||
pkg_search_module( SQLITE3 ${_pkgconfig_REQUIRED} sqlite3 )
|
||||
ENDIF ( SQLITE3_MIN_VERSION )
|
||||
if (SQLITE3_LIBRARIES AND SQLITE3_INCLUDE_DIRS)
|
||||
# in cache already
|
||||
set(SQLITE3_FOUND TRUE)
|
||||
else (SQLITE3_LIBRARIES AND SQLITE3_INCLUDE_DIRS)
|
||||
# use pkg-config to get the directories and then use these values
|
||||
# in the FIND_PATH() and FIND_LIBRARY() calls
|
||||
include(UsePkgConfig)
|
||||
|
||||
pkgconfig(sqlite3 _Sqlite3IncDir _Sqlite3LinkDir _Sqlite3LinkFlags _Sqlite3Cflags)
|
||||
|
||||
# Look for sqlite3 include dir and libraries w/o pkgconfig
|
||||
IF ( NOT SQLITE3_FOUND AND NOT PKG_CONFIG_FOUND )
|
||||
FIND_PATH( _sqlite3_include_DIR sqlite3.h
|
||||
PATHS
|
||||
/opt/local/include/
|
||||
/sw/include/
|
||||
/usr/local/include/
|
||||
/usr/include/
|
||||
)
|
||||
FIND_LIBRARY( _sqlite3_link_DIR sqlite3
|
||||
PATHS
|
||||
/opt/local/lib
|
||||
/sw/lib
|
||||
/usr/lib
|
||||
/usr/local/lib
|
||||
/usr/lib64
|
||||
/usr/local/lib64
|
||||
/opt/lib64
|
||||
)
|
||||
IF ( _sqlite3_include_DIR AND _sqlite3_link_DIR )
|
||||
SET ( _sqlite3_FOUND TRUE )
|
||||
ENDIF ( _sqlite3_include_DIR AND _sqlite3_link_DIR )
|
||||
set(SQLITE3_DEFINITIONS ${_Sqlite3Cflags})
|
||||
|
||||
find_path(SQLITE3_INCLUDE_DIR
|
||||
NAMES
|
||||
sqlite3.h
|
||||
PATHS
|
||||
${_Sqlite3IncDir}
|
||||
/usr/include
|
||||
/usr/local/include
|
||||
/opt/local/include
|
||||
/sw/include
|
||||
)
|
||||
|
||||
IF ( _sqlite3_FOUND )
|
||||
SET ( SQLITE3_INCLUDE_DIRS ${_sqlite3_include_DIR} )
|
||||
SET ( SQLITE3_LIBRARIES ${_sqlite3_link_DIR} )
|
||||
ENDIF ( _sqlite3_FOUND )
|
||||
find_library(SQLITE3_LIBRARY
|
||||
NAMES
|
||||
sqlite3
|
||||
PATHS
|
||||
${_Sqlite3LinkDir}
|
||||
/usr/lib
|
||||
/usr/local/lib
|
||||
/opt/local/lib
|
||||
/sw/lib
|
||||
)
|
||||
|
||||
# Report results
|
||||
IF ( SQLITE3_LIBRARIES AND SQLITE3_INCLUDE_DIRS AND _sqlite3_FOUND )
|
||||
SET( SQLITE3_FOUND 1 )
|
||||
IF ( NOT Sqlite3_FIND_QUIETLY )
|
||||
MESSAGE( STATUS "Found sqlite3: ${SQLITE3_LIBRARIES} ${SQLITE3_INCLUDE_DIRS}" )
|
||||
ENDIF ( NOT Sqlite3_FIND_QUIETLY )
|
||||
ELSE ( SQLITE3_LIBRARIES AND SQLITE3_INCLUDE_DIRS AND _sqlite3_FOUND )
|
||||
IF ( Sqlite3_FIND_REQUIRED )
|
||||
MESSAGE( SEND_ERROR "Could NOT find sqlite3" )
|
||||
ELSE ( Sqlite3_FIND_REQUIRED )
|
||||
IF ( NOT Sqlite3_FIND_QUIETLY )
|
||||
MESSAGE( STATUS "Could NOT find sqlite3" )
|
||||
ENDIF ( NOT Sqlite3_FIND_QUIETLY )
|
||||
ENDIF ( Sqlite3_FIND_REQUIRED )
|
||||
ENDIF ( SQLITE3_LIBRARIES AND SQLITE3_INCLUDE_DIRS AND _sqlite3_FOUND )
|
||||
if (SQLITE3_LIBRARY)
|
||||
set(SQLITE3_FOUND TRUE)
|
||||
endif (SQLITE3_LIBRARY)
|
||||
|
||||
ENDIF ( NOT SQLITE3_FOUND AND NOT PKG_CONFIG_FOUND )
|
||||
set(SQLITE3_INCLUDE_DIRS
|
||||
${SQLITE3_INCLUDE_DIR}
|
||||
)
|
||||
|
||||
# Hide advanced variables from CMake GUIs
|
||||
MARK_AS_ADVANCED( SQLITE3_LIBRARIES SQLITE3_INCLUDE_DIRS )
|
||||
if (SQLITE3_FOUND)
|
||||
set(SQLITE3_LIBRARIES
|
||||
${SQLITE3_LIBRARIES}
|
||||
${SQLITE3_LIBRARY}
|
||||
)
|
||||
endif (SQLITE3_FOUND)
|
||||
|
||||
if (SQLITE3_INCLUDE_DIRS AND SQLITE3_LIBRARIES)
|
||||
set(SQLITE3_FOUND TRUE)
|
||||
endif (SQLITE3_INCLUDE_DIRS AND SQLITE3_LIBRARIES)
|
||||
|
||||
if (SQLITE3_FOUND)
|
||||
if (NOT Sqlite3_FIND_QUIETLY)
|
||||
message(STATUS "Found Sqlite3: ${SQLITE3_LIBRARIES}")
|
||||
endif (NOT Sqlite3_FIND_QUIETLY)
|
||||
else (SQLITE3_FOUND)
|
||||
if (Sqlite3_FIND_REQUIRED)
|
||||
message(FATAL_ERROR "Could not find Sqlite3")
|
||||
endif (Sqlite3_FIND_REQUIRED)
|
||||
endif (SQLITE3_FOUND)
|
||||
|
||||
# show the SQLITE3_INCLUDE_DIRS and SQLITE3_LIBRARIES variables only in the advanced view
|
||||
mark_as_advanced(SQLITE3_INCLUDE_DIRS SQLITE3_LIBRARIES)
|
||||
|
||||
endif (SQLITE3_LIBRARIES AND SQLITE3_INCLUDE_DIRS)
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче