-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCMakeLists.txt
More file actions
59 lines (48 loc) · 1.68 KB
/
CMakeLists.txt
File metadata and controls
59 lines (48 loc) · 1.68 KB
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
57
58
59
cmake_minimum_required(VERSION 3.14)
project(sqlite-cmake
DESCRIPTION "Unified SQLite CMake integration module"
LANGUAGES C CXX)
# Option to build examples
option(SQLITE_CMAKE_BUILD_EXAMPLES "Build SQLite CMake examples" ON)
# Make the cmake modules available
list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake)
# Include SQLiteConfig to make add_sqlite available
include(${CMAKE_CURRENT_SOURCE_DIR}/cmake/SQLiteConfig.cmake)
# Also make the module path available to parent scope for includes
if(NOT CMAKE_CURRENT_SOURCE_DIR STREQUAL CMAKE_SOURCE_DIR)
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} PARENT_SCOPE)
endif()
# Export the package for use from the build tree
export(PACKAGE SQLiteCMake)
# Create package config files
include(CMakePackageConfigHelpers)
# Generate the config file
configure_package_config_file(
${CMAKE_CURRENT_SOURCE_DIR}/cmake/SQLiteConfig.cmake
${CMAKE_CURRENT_BINARY_DIR}/SQLiteCMakeConfig.cmake
INSTALL_DESTINATION lib/cmake/SQLiteCMake
PATH_VARS CMAKE_INSTALL_PREFIX
)
# Generate the version file
write_basic_package_version_file(
${CMAKE_CURRENT_BINARY_DIR}/SQLiteCMakeConfigVersion.cmake
VERSION 0.2.1
COMPATIBILITY AnyNewerVersion
)
# Install the CMake modules
install(FILES
cmake/SQLiteConfig.cmake
cmake/PublicSQLite.cmake
cmake/NDSSQLite.cmake
DESTINATION lib/cmake/SQLiteCMake
)
# Install the generated config files
install(FILES
${CMAKE_CURRENT_BINARY_DIR}/SQLiteCMakeConfig.cmake
${CMAKE_CURRENT_BINARY_DIR}/SQLiteCMakeConfigVersion.cmake
DESTINATION lib/cmake/SQLiteCMake
)
# Build examples if requested
if(SQLITE_CMAKE_BUILD_EXAMPLES)
add_subdirectory(examples/basic)
endif()