diff --git a/ports/sqlite3/CMakeLists.txt b/ports/sqlite3/CMakeLists.txt index b4b105a65..c9c3b9c7f 100644 --- a/ports/sqlite3/CMakeLists.txt +++ b/ports/sqlite3/CMakeLists.txt @@ -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 - $<$:SQLITE_DEBUG> - ${API} - -DSQLITE_ENABLE_RTREE - -DSQLITE_ENABLE_UNLOCK_NOTIFY - ) +target_compile_definitions( + sqlite3 + PRIVATE + $<$:SQLITE_DEBUG> + ${API} + -DSQLITE_ENABLE_RTREE + -DSQLITE_ENABLE_UNLOCK_NOTIFY +) target_include_directories(sqlite3 INTERFACE $) +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) diff --git a/ports/sqlite3/CONTROL b/ports/sqlite3/CONTROL index 8676a5628..52c97b919 100644 --- a/ports/sqlite3/CONTROL +++ b/ports/sqlite3/CONTROL @@ -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 diff --git a/ports/sqlite3/portfile.cmake b/ports/sqlite3/portfile.cmake index 64678f549..423dda8c5 100644 --- a/ports/sqlite3/portfile.cmake +++ b/ports/sqlite3/portfile.cmake @@ -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() diff --git a/ports/sqlite3/sqlite3-config.in.cmake b/ports/sqlite3/sqlite3-config.in.cmake new file mode 100644 index 000000000..538342cf4 --- /dev/null +++ b/ports/sqlite3/sqlite3-config.in.cmake @@ -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)