vcpkg/ports/libodb/CMakeLists.txt

48 lines
1.4 KiB
CMake
Raw Normal View History

2016-10-19 05:57:53 +08:00
cmake_minimum_required(VERSION 3.0)
project(libodb VERSION 2.4.0 LANGUAGES CXX)
2016-10-19 07:53:43 +08:00
set(LIBODB_INSTALL_HEADERS ON CACHE BOOL "Install the header files (a debug install)")
configure_file(config.unix.h.in
${CMAKE_CURRENT_SOURCE_DIR}/odb/details/config.h COPYONLY)
2016-10-19 05:57:53 +08:00
file(GLOB_RECURSE libodb_src LIST_DIRECTORIES False
RELATIVE ${CMAKE_CURRENT_SOURCE_DIR}
*.cxx)
if (WIN32)
list(FILTER libodb_src EXCLUDE REGEX /posix/.*)
elseif (UNIX)
list(FILTER libodb_src EXCLUDE REGEX /win32/.*)
endif()
2016-10-19 05:57:53 +08:00
add_library(libodb ${libodb_src})
target_include_directories(libodb
PUBLIC
2016-10-19 07:53:43 +08:00
$<INSTALL_INTERFACE:include>
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>
2016-10-19 05:57:53 +08:00
)
if(BUILD_SHARED_LIBS)
target_compile_definitions(libodb PRIVATE
-DLIBODB_DYNAMIC_LIB)
else()
target_compile_definitions(libodb PRIVATE
-DLIBODB_STATIC_LIB)
endif()
2016-10-19 12:30:28 +08:00
install(TARGETS libodb EXPORT odb_libodbConfig
COMPONENT libodb
2016-10-19 05:57:53 +08:00
ARCHIVE DESTINATION lib
LIBRARY DESTINATION lib
RUNTIME DESTINATION bin
)
if(LIBODB_INSTALL_HEADERS)
install(DIRECTORY odb DESTINATION include/
2016-10-19 12:30:28 +08:00
COMPONENT libodb
2016-10-19 05:57:53 +08:00
FILES_MATCHING
PATTERN "*.h"
PATTERN "*.hxx"
PATTERN "*.ixx"
PATTERN "*.txx"
)
endif()
2016-10-19 12:30:28 +08:00
install(EXPORT odb_libodbConfig NAMESPACE odb:: COMPONENT libodb DESTINATION share/odb)
export(TARGETS libodb NAMESPACE odb:: FILE odb_libodbConfig.cmake)