-
Notifications
You must be signed in to change notification settings - Fork 4
/
CMakeLists.txt.in
59 lines (44 loc) · 1.73 KB
/
CMakeLists.txt.in
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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
cmake_minimum_required(VERSION 3.12.0)
project(duckdb-odbc)
find_package(ODBC)
find_package(Threads REQUIRED)
set(CMAKE_CXX_STANDARD "11" CACHE STRING "C++ standard to enforce")
set(CMAKE_VERBOSE_MAKEFILE OFF)
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
if(NOT ODBC_FOUND)
message(FATAL_ERROR "No ODBC found; you need to install unixodbc-dev.")
endif()
set(LINK_LIB_LIST "")
if(ODBC_FOUND)
find_library(ODBCINST_LIB NAMES odbcinst libodbcinst)
if(ODBCINST_LIB)
list(APPEND LINK_LIB_LIST ${ODBCINST_LIB})
add_definitions(-DODBC_LINK_ODBCINST)
message(STATUS "Found ODBCINST_LIB: " ${ODBCINST_LIB})
endif()
if(WIN32)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/bin)
add_subdirectory(winsetup)
list(APPEND LINK_LIB_LIST $<$<PLATFORM_ID:Windows>:odbccp32>)
list(APPEND LINK_LIB_LIST
$<$<PLATFORM_ID:Windows>:legacy_stdio_definitions>)
endif()
endif()
set(DUCKDB_SYSTEM_LIBS ${CMAKE_DL_LIBS})
if(MSVC)
set(DUCKDB_SYSTEM_LIBS ${DUCKDB_SYSTEM_LIBS} ws2_32 rstrtmgr bcrypt)
endif()
if(OSX_BUILD_UNIVERSAL)
SET(CMAKE_OSX_ARCHITECTURES "x86_64;arm64" CACHE STRING "Build architectures for Mac OS X" FORCE)
endif()
add_definitions(-DDUCKDB_BUILD_LIBRARY -DNO_FRAMEWORKS ${DEFINES})
include_directories(src/duckdb/src/include/ ${INCLUDE_FILES} ${ODBC_INCLUDE_DIRS} include)
add_subdirectory(src)
set(ALL_OBJECT_FILES ${ALL_OBJECT_FILES} ${SOURCE_FILES})
add_library(duckdb_odbc SHARED ${ALL_OBJECT_FILES} duckdb_odbc.def)
set_target_properties(duckdb_odbc PROPERTIES DEFINE_SYMBOL "DUCKDB_ODBC_API")
target_link_libraries(duckdb_odbc ${LINK_LIB_LIST} ${LIBRARY_FILES})
target_link_libraries(duckdb_odbc Threads::Threads ${DUCKDB_SYSTEM_LIBS})
if(NOT CLANG_TIDY)
add_subdirectory(test)
endif()