vcpkg/ports/libodb-sqlite/CMakeLists.txt

48 lines
1.6 KiB
CMake
Raw Normal View History

2016-10-19 07:53:43 +08:00
cmake_minimum_required(VERSION 3.0)
project(libodb-sqlite VERSION 2.4.0 LANGUAGES CXX)
2016-10-19 12:30:28 +08:00
find_package(odb 2.4.0 REQUIRED COMPONENTS libodb)
find_package(sqlite3 CONFIG)
configure_file(config.unix.h.in
${CMAKE_CURRENT_SOURCE_DIR}/odb/sqlite/details/config.h COPYONLY)
2016-10-19 07:53:43 +08:00
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}
*.cxx)
list(FILTER libodb_src EXCLUDE REGEX /posix/.*)
2016-10-19 13:28:50 +08:00
add_library(libodb-sqlite ${libodb_src})
target_include_directories(libodb-sqlite
2016-10-19 07:53:43 +08:00
PUBLIC
$<INSTALL_INTERFACE:include>
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>
)
2016-10-19 12:30:28 +08:00
2016-10-19 13:28:50 +08:00
target_link_libraries(libodb-sqlite PRIVATE odb::libodb sqlite3)
2016-10-19 07:53:43 +08:00
if(BUILD_SHARED_LIBS)
2016-10-19 13:28:50 +08:00
target_compile_definitions(libodb-sqlite PRIVATE
2016-10-19 07:53:43 +08:00
-DLIBODB_SQLITE_DYNAMIC_LIB
-DLIBODB_SQLITE_HAVE_UNLOCK_NOTIFY)
else()
2016-10-19 13:28:50 +08:00
target_compile_definitions(libodb-sqlite PRIVATE
2016-10-19 07:53:43 +08:00
-DLIBODB_SQLITE_STATIC_LIB
-DLIBODB_SQLITE_HAVE_UNLOCK_NOTIFY)
endif()
2016-10-19 13:28:50 +08:00
install(TARGETS libodb-sqlite EXPORT odb_sqliteConfig
2016-10-19 07:53:43 +08:00
COMPONENT sqlite
ARCHIVE DESTINATION lib
LIBRARY DESTINATION lib
RUNTIME DESTINATION bin
)
if(LIBODB_INSTALL_HEADERS)
install(DIRECTORY odb DESTINATION include/
COMPONENT sqlite
FILES_MATCHING
PATTERN "*.h"
PATTERN "*.hxx"
PATTERN "*.ixx"
PATTERN "*.txx"
)
endif()
2016-10-19 12:30:28 +08:00
install(EXPORT odb_sqliteConfig NAMESPACE odb:: COMPONENT sqlite DESTINATION share/odb)
2016-10-19 13:28:50 +08:00
export(TARGETS libodb-sqlite NAMESPACE odb:: FILE odb_sqliteConfig.cmake)