mirror of
https://github.com/microsoft/vcpkg.git
synced 2024-12-28 03:10:57 +08:00
[sqlite3] Improve usage on non-Windows; Fixes example and Fixes #3703
This commit is contained in:
parent
a650bad523
commit
3726ce9557
@ -1,4 +1,4 @@
|
||||
cmake_minimum_required(VERSION 3.0)
|
||||
cmake_minimum_required(VERSION 3.10)
|
||||
project(sqlite3 C)
|
||||
|
||||
include_directories(.)
|
||||
@ -9,13 +9,19 @@ else()
|
||||
endif()
|
||||
add_library(sqlite3 sqlite3.c)
|
||||
|
||||
target_compile_definitions(sqlite3 PRIVATE
|
||||
$<$<CONFIG:Debug>:SQLITE_DEBUG>
|
||||
${API}
|
||||
-DSQLITE_ENABLE_RTREE
|
||||
-DSQLITE_ENABLE_UNLOCK_NOTIFY
|
||||
)
|
||||
target_compile_definitions(
|
||||
sqlite3
|
||||
PRIVATE
|
||||
$<$<CONFIG:Debug>:SQLITE_DEBUG>
|
||||
${API}
|
||||
-DSQLITE_ENABLE_RTREE
|
||||
-DSQLITE_ENABLE_UNLOCK_NOTIFY
|
||||
)
|
||||
target_include_directories(sqlite3 INTERFACE $<INSTALL_INTERFACE:include>)
|
||||
if(NOT WIN32)
|
||||
find_package(Threads REQUIRED)
|
||||
target_link_libraries(sqlite3 PRIVATE Threads::Threads ${CMAKE_DL_LIBS})
|
||||
endif()
|
||||
|
||||
if(CMAKE_SYSTEM_NAME MATCHES "WindowsStore")
|
||||
target_compile_definitions(sqlite3 PRIVATE -DSQLITE_OS_WINRT=1)
|
||||
@ -32,11 +38,13 @@ if(NOT SQLITE3_SKIP_TOOLS)
|
||||
)
|
||||
endif()
|
||||
|
||||
install(TARGETS sqlite3 EXPORT sqlite3Config
|
||||
install(
|
||||
TARGETS sqlite3
|
||||
EXPORT sqlite3
|
||||
RUNTIME DESTINATION bin
|
||||
LIBRARY DESTINATION lib
|
||||
ARCHIVE DESTINATION lib
|
||||
)
|
||||
|
||||
install(FILES sqlite3.h sqlite3ext.h DESTINATION include CONFIGURATIONS Release)
|
||||
install(EXPORT sqlite3Config DESTINATION share/sqlite3)
|
||||
install(EXPORT sqlite3 FILE sqlite3-targets.cmake DESTINATION share/sqlite3)
|
||||
|
@ -1,5 +1,5 @@
|
||||
Source: sqlite3
|
||||
Version: 3.24.0
|
||||
Version: 3.24.0-1
|
||||
Description: SQLite is a software library that implements a self-contained, serverless, zero-configuration, transactional SQL database engine.
|
||||
|
||||
Feature: tool
|
||||
|
@ -27,14 +27,15 @@ vcpkg_configure_cmake(
|
||||
)
|
||||
|
||||
vcpkg_install_cmake()
|
||||
|
||||
if(NOT DEFINED VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL "debug")
|
||||
file(READ ${CURRENT_PACKAGES_DIR}/debug/share/sqlite3/sqlite3Config-debug.cmake SQLITE3_DEBUG_CONFIG)
|
||||
string(REPLACE "\${_IMPORT_PREFIX}" "\${_IMPORT_PREFIX}/debug" SQLITE3_DEBUG_CONFIG "${SQLITE3_DEBUG_CONFIG}")
|
||||
file(WRITE ${CURRENT_PACKAGES_DIR}/share/sqlite3/sqlite3Config-debug.cmake "${SQLITE3_DEBUG_CONFIG}")
|
||||
endif()
|
||||
vcpkg_fixup_cmake_targets()
|
||||
|
||||
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/share)
|
||||
|
||||
configure_file(
|
||||
${CMAKE_CURRENT_LIST_DIR}/sqlite3-config.in.cmake
|
||||
${CURRENT_PACKAGES_DIR}/share/sqlite3/sqlite3-config.cmake
|
||||
@ONLY
|
||||
)
|
||||
|
||||
file(WRITE ${CURRENT_PACKAGES_DIR}/share/sqlite3/copyright "SQLite is in the Public Domain.\nhttp://www.sqlite.org/copyright.html\n")
|
||||
vcpkg_copy_pdbs()
|
||||
|
7
ports/sqlite3/sqlite3-config.in.cmake
Normal file
7
ports/sqlite3/sqlite3-config.in.cmake
Normal file
@ -0,0 +1,7 @@
|
||||
|
||||
if("@VCPKG_LIBRARY_LINKAGE@" STREQUAL "static" AND NOT WIN32)
|
||||
include(CMakeFindDependencyMacro)
|
||||
find_dependency(Threads)
|
||||
endif()
|
||||
|
||||
include(${CMAKE_CURRENT_LIST_DIR}/sqlite3-targets.cmake)
|
Loading…
x
Reference in New Issue
Block a user