mirror of
https://github.com/microsoft/vcpkg.git
synced 2024-12-28 19:25:27 +08:00
add overall odb config
This commit is contained in:
parent
cc6fdbeb8b
commit
c879ba6d36
@ -1,6 +1,7 @@
|
||||
cmake_minimum_required(VERSION 3.0)
|
||||
project(libodb-sqlite VERSION 2.4.0 LANGUAGES CXX)
|
||||
find_package(libodb REQUIRED VERSION 2.4.0)
|
||||
find_package(odb 2.4.0 REQUIRED COMPONENTS libodb)
|
||||
find_library(SQLITE3_LIBRARY names sqlite sqlite3)
|
||||
set(LIBODB_INSTALL_HEADERS ON CACHE BOOL "Install the header files (a debug install)")
|
||||
file(GLOB_RECURSE libodb_src LIST_DIRECTORIES False
|
||||
RELATIVE ${CMAKE_CURRENT_SOURCE_DIR}
|
||||
@ -13,7 +14,8 @@ target_include_directories(sqlite
|
||||
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>
|
||||
|
||||
)
|
||||
target_link_libraries(sqlite libodb::libodb)
|
||||
|
||||
target_link_libraries(sqlite PRIVATE odb::libodb ${SQLITE3_LIBRARY})
|
||||
if(BUILD_SHARED_LIBS)
|
||||
target_compile_definitions(sqlite PRIVATE
|
||||
-DLIBODB_SQLITE_DYNAMIC_LIB
|
||||
@ -23,7 +25,7 @@ else()
|
||||
-DLIBODB_SQLITE_STATIC_LIB
|
||||
-DLIBODB_SQLITE_HAVE_UNLOCK_NOTIFY)
|
||||
endif()
|
||||
install(TARGETS sqlite EXPORT libodb_sqliteConfig
|
||||
install(TARGETS sqlite EXPORT odb_sqliteConfig
|
||||
COMPONENT sqlite
|
||||
ARCHIVE DESTINATION lib
|
||||
LIBRARY DESTINATION lib
|
||||
@ -39,5 +41,5 @@ install(DIRECTORY odb DESTINATION include/
|
||||
PATTERN "*.txx"
|
||||
)
|
||||
endif()
|
||||
install(EXPORT libodb_sqliteConfig DESTINATION share/libodb)
|
||||
export(TARGETS sqlite NAMESPACE libodb FILE libodb_sqliteConfig.cmake)
|
||||
install(EXPORT odb_sqliteConfig NAMESPACE odb:: COMPONENT sqlite DESTINATION share/odb)
|
||||
export(TARGETS sqlite NAMESPACE odb:: FILE odb_sqliteConfig.cmake)
|
||||
|
@ -1,4 +1,4 @@
|
||||
Source: libodb-sqlite
|
||||
Version:
|
||||
Description:
|
||||
Version: 2.4.0
|
||||
Description: Sqlite support for the ODB ORM library
|
||||
Build-Depends: libodb, sqlite3
|
||||
|
@ -19,13 +19,15 @@ else()
|
||||
target_compile_definitions(libodb PRIVATE
|
||||
-DLIBODB_STATIC_LIB)
|
||||
endif()
|
||||
install(TARGETS libodb EXPORT libodbConfig
|
||||
install(TARGETS libodb EXPORT odb_libodbConfig
|
||||
COMPONENT libodb
|
||||
ARCHIVE DESTINATION lib
|
||||
LIBRARY DESTINATION lib
|
||||
RUNTIME DESTINATION bin
|
||||
)
|
||||
if(LIBODB_INSTALL_HEADERS)
|
||||
install(DIRECTORY odb DESTINATION include/
|
||||
COMPONENT libodb
|
||||
FILES_MATCHING
|
||||
PATTERN "*.h"
|
||||
PATTERN "*.hxx"
|
||||
@ -33,5 +35,5 @@ install(DIRECTORY odb DESTINATION include/
|
||||
PATTERN "*.txx"
|
||||
)
|
||||
endif()
|
||||
install(EXPORT libodbConfig NAMESPACE libodb:: DESTINATION share/libodb)
|
||||
export(TARGETS libodb NAMESPACE libodb:: FILE libodbConfig.cmake)
|
||||
install(EXPORT odb_libodbConfig NAMESPACE odb:: COMPONENT libodb DESTINATION share/odb)
|
||||
export(TARGETS libodb NAMESPACE odb:: FILE odb_libodbConfig.cmake)
|
||||
|
10
ports/libodb/odbConfig.cmake
Normal file
10
ports/libodb/odbConfig.cmake
Normal file
@ -0,0 +1,10 @@
|
||||
set(_supported_components libodb sqlite)
|
||||
|
||||
foreach(_comp ${odb_FIND_COMPONENTS})
|
||||
if(NOT ";${_supported_components};" MATCHES _comp)
|
||||
set(odb_FOUND False)
|
||||
set(odb_NOTFOUND_MESSAGE "Unsupported component: ${_comp}")
|
||||
endif()
|
||||
include("${CMAKE_CURRENT_LIST_DIR}/odb_${_comp}Config.cmake")
|
||||
endforeach()
|
||||
set(odb_FOUND True)
|
@ -8,6 +8,7 @@
|
||||
|
||||
include(${CMAKE_TRIPLET_FILE})
|
||||
include(vcpkg_common_functions)
|
||||
include(CMakePackageConfigHelpers)
|
||||
set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/libodb-2.4.0)
|
||||
vcpkg_download_distfile(ARCHIVE
|
||||
URLS "http://www.codesynthesis.com/download/odb/2.4/libodb-2.4.0.tar.gz"
|
||||
@ -23,10 +24,15 @@ vcpkg_configure_cmake(
|
||||
)
|
||||
vcpkg_build_cmake()
|
||||
vcpkg_install_cmake()
|
||||
file(READ ${CURRENT_PACKAGES_DIR}/debug/share/libodb/libodbConfig-debug.cmake LIBODB_DEBUG_TARGETS)
|
||||
file(READ ${CURRENT_PACKAGES_DIR}/debug/share/odb/odb_libodbConfig-debug.cmake LIBODB_DEBUG_TARGETS)
|
||||
string(REPLACE "\${_IMPORT_PREFIX}" "\${_IMPORT_PREFIX}/debug" LIBODB_DEBUG_TARGETS "${LIBODB_DEBUG_TARGETS}")
|
||||
file(WRITE ${CURRENT_PACKAGES_DIR}/share/libodb/libodbConfig-debug.cmake "${LIBODB_DEBUG_TARGETS}")
|
||||
file(WRITE ${CURRENT_PACKAGES_DIR}/share/odb/odb_libodbConfig-debug.cmake "${LIBODB_DEBUG_TARGETS}")
|
||||
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/share)
|
||||
file(COPY ${CMAKE_CURRENT_LIST_DIR}/odbConfig.cmake DESTINATION ${CURRENT_PACKAGES_DIR}/share/odb)
|
||||
write_basic_package_version_file(${CURRENT_PACKAGES_DIR}/share/odb/odbConfigVersion.cmake
|
||||
VERSION 2.4.0
|
||||
COMPATIBILITY SameMajorVersion
|
||||
)
|
||||
# Handle copyright
|
||||
file(COPY ${SOURCE_PATH}/LICENSE DESTINATION ${CURRENT_PACKAGES_DIR}/share/libodb)
|
||||
file(RENAME ${CURRENT_PACKAGES_DIR}/share/libodb/LICENSE ${CURRENT_PACKAGES_DIR}/share/libodb/copyright)
|
||||
|
Loading…
x
Reference in New Issue
Block a user