kdelibs/cmake/modules/FindSqlite.cmake
Ivailo Monev 3065f6f156 cmake: review CMake modules rewritten by me
since find_package_handle_standard_args() is used and no status messages
are printed by the modules there is no reason to set <MODULE>_FIND_QUIETLY
variable (which should be prefixed with the actual module name, not upper
case)

Signed-off-by: Ivailo Monev <xakepa10@laimg.moc>
2020-02-19 20:52:40 +00:00

42 lines
1.1 KiB
CMake

# - Try to find Sqlite
#
# Once done this will define
#
# SQLITE_FOUND - system has Sqlite
# SQLITE_INCLUDE_DIR - the Sqlite include directory
# SQLITE_LIBRARIES - the libraries needed to use Sqlite
#
# Copyright (c) 2020, Ivailo Monev, <xakepa10@gmail.com>
#
# Redistribution and use is allowed according to the terms of the BSD license.
# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
if(NOT WIN32)
include(FindPkgConfig)
pkg_check_modules(PC_SQLITE QUIET sqlite3)
set(SQLITE_INCLUDE_DIR ${PC_SQLITE_INCLUDE_DIRS})
set(SQLITE_LIBRARIES ${PC_SQLITE_LIBRARIES})
endif()
set(SQLITE_VERSION ${PC_SQLITE_VERSION})
if(NOT SQLITE_INCLUDE_DIR OR NOT SQLITE_LIBRARIES)
find_path(SQLITE_INCLUDE_DIR
NAMES sqlite3.h
HINTS $ENV{SQLITEDIR}/include
)
find_library(SQLITE_LIBRARIES
NAMES sqlite3
HINTS $ENV{SQLITEDIR}/lib
)
endif()
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(Sqlite
VERSION_VAR SQLITE_VERSION
REQUIRED_VARS SQLITE_LIBRARIES SQLITE_INCLUDE_DIR
)
mark_as_advanced(SQLITE_INCLUDE_DIR SQLITE_LIBRARIES)