-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists.txt
31 lines (25 loc) · 1.05 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
cmake_minimum_required(VERSION 3.10)
project(DbMessenger C)
set(CMAKE_C_STANDARD 11)
set(ecpg_files Accounts.pgc Context.pgc Dialogs.pgc Locks.pgc Messages.pgc)
execute_process(
COMMAND ecpg ${ecpg_files}
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
)
add_executable(${PROJECT_NAME}
Accounts.c Context.c Dialogs.c Locks.c Messages.c
Accounts.h Context.h Dialogs.h Locks.h Messages.h
IO.c main.c
IO.h)
target_compile_definitions(${PROJECT_NAME} PUBLIC HAVE_LONG_LONG_INT_64)
execute_process(COMMAND pg_config --includedir OUTPUT_VARIABLE ECPG_INCLUDEDIR)
target_include_directories(${PROJECT_NAME} PUBLIC ${ECPG_INCLUDEDIR})
if (WIN32)
execute_process(COMMAND pg_config --libdir OUTPUT_VARIABLE ECPG_LIBDIR)
find_library(ECPG_LIB libecpg HINTS ${ECPG_LIBDIR} REQUIRED)
find_library(PGTYPES_LIB libpgtypes HINTS ${ECPG_LIBDIR} REQUIRED)
target_link_libraries(${PROJECT_NAME} PUBLIC ${ECPG_LIB} ${PGTYPES_LIB})
endif (WIN32)
if (UNIX)
target_link_libraries(${PROJECT_NAME} PUBLIC ecpg pgtypes)
endif (UNIX)