generated from duckdb/extension-template
-
Notifications
You must be signed in to change notification settings - Fork 4
/
CMakeLists.txt
38 lines (31 loc) · 1.27 KB
/
CMakeLists.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
cmake_minimum_required(VERSION 2.8.12)
# Set extension name here
set(TARGET_NAME odbc_scanner)
set(EXTENSION_NAME ${TARGET_NAME}_extension)
project(${TARGET_NAME})
include_directories(src/include)
set(
EXTENSION_SOURCES
src/odbc_scan.cpp
src/odbc_scanner_extension.cpp
)
add_library(${EXTENSION_NAME} STATIC ${EXTENSION_SOURCES})
set(PARAMETERS "-warnings")
build_loadable_extension(${TARGET_NAME} ${PARAMETERS} ${EXTENSION_SOURCES})
# nix store location of ODBC_CONFIG is passed in as CLIENT_FLAGS to root level Makefile
# set(ODBC_CONFIG /nix/store/xs4bg5404nsjarivdzxszq0z0pn2ckzv-unixODBC-2.3.11/bin/odbc_config)
find_package(ODBC REQUIRED ODBC_INCLUDE_DIR ODBC_LIBRARY)
if(NOT ODBC_FOUND)
message(FATAL_ERROR "No ODBC found")
endif()
# Link ODBC to static lib
target_include_directories(${EXTENSION_NAME} PUBLIC $<BUILD_INTERFACE:${ODBC_INCLUDE_DIR}>)
target_link_libraries(${EXTENSION_NAME} ${ODBC_LIBRARIES})
# Link ODBC to loadable binary
target_include_directories(${TARGET_NAME}_loadable_extension PRIVATE $<BUILD_INTERFACE:${ODBC_INCLUDE_DIR}>)
target_link_libraries(${TARGET_NAME}_loadable_extension ${ODBC_LIBRARIES})
install(
TARGETS ${EXTENSION_NAME}
EXPORT "${DUCKDB_EXPORT_SET}"
LIBRARY DESTINATION "${INSTALL_LIB_DIR}"
ARCHIVE DESTINATION "${INSTALL_LIB_DIR}")