-
Notifications
You must be signed in to change notification settings - Fork 145
/
CMakeLists.txt
34 lines (28 loc) · 1.24 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
cmake_minimum_required(VERSION 3.15 FATAL_ERROR)
project(multicorn)
set(CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake)
set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>")
set(CMAKE_FIND_LIBRARY_PREFIXES "")
set(CMAKE_FIND_LIBRARY_SUFFIXES ".lib")
add_library(multicorn SHARED src/errors.c src/python.c src/query.c src/multicorn.c src/utils.c)
if (WIN32)
set_target_properties(multicorn PROPERTIES LINK_FLAGS /EXPORT:PyInit__utils)
endif (WIN32)
set(Python_FIND_REGISTRY LAST)
find_package(Python REQUIRED COMPONENTS Interpreter Development)
target_link_libraries(multicorn ${Python_LIBRARIES})
target_link_directories(multicorn PUBLIC ${Python_LIBRARY_DIRS})
target_include_directories(multicorn PUBLIC ${Python_INCLUDE_DIRS})
find_package(PostgreSQL REQUIRED)
target_link_libraries(multicorn ${PostgreSQL_LIBRARIES})
if(WIN32)
target_link_libraries(multicorn postgres)
endif(WIN32)
target_link_directories(multicorn PUBLIC ${PostgreSQL_LIBRARY_DIRS})
target_include_directories(multicorn PUBLIC ${PostgreSQL_INCLUDE_DIRS})
if(WIN32)
target_include_directories(multicorn PUBLIC ${PostgreSQL_INCLUDE_DIR}/server/port/win32)
endif()
if(MSVC)
target_include_directories(multicorn PUBLIC ${PostgreSQL_INCLUDE_DIR}/server/port/win32_msvc)
endif()