-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists.txt
83 lines (70 loc) · 2.45 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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
cmake_minimum_required(VERSION 3.10)
project(pg_json_serdes)
set(CMAKE_CXX_STANDARD 11)
add_library(${PROJECT_NAME})
target_include_directories(
${PROJECT_NAME}
PUBLIC $<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/lib/inc>)
target_include_directories(${PROJECT_NAME}
PUBLIC ${CMAKE_SOURCE_DIR}/lib/inc)
target_include_directories(${PROJECT_NAME}
PRIVATE ${CMAKE_SOURCE_DIR}/lib/src)
aux_source_directory(${CMAKE_SOURCE_DIR}/lib/src SRC_DIR)
set(public_headers
lib/inc/pg_json/Buffer.h
lib/inc/pg_json/Catalogue.h
lib/inc/pg_json/Converter.h
lib/inc/pg_json/Cursor.h
lib/inc/pg_json/json.h
lib/inc/pg_json/PgField.h
lib/inc/pg_json/PgFormat.h
lib/inc/pg_json/PgFunc.h
lib/inc/pg_json/PgParamSetter.h
lib/inc/pg_json/PgReader.h
lib/inc/pg_json/PgResult.h
lib/inc/pg_json/PgType.h
lib/inc/pg_json/PgWriter.h
lib/inc/pg_json/utils/GeneralParamSetter.h
lib/inc/pg_json/utils/PgResultWrapper.h
lib/inc/pg_json/utils/RawCursor.h
lib/inc/pg_json/utils/StringBuffer.h)
set(private_headers
lib/src/ByteOrder.h
lib/src/CatalogueImpl.h
lib/src/MetaSql.h
lib/src/PgBinaryReader.h
lib/src/PgBinaryWriter.h
lib/src/PgFieldImpl.h
lib/src/PgFuncImpl.h
lib/src/PgTextReader.h
lib/src/PgTextWriter.h
lib/src/PgTypeImpl.h
lib/src/Scope.h)
set(PJ_SRC
lib/src/Catalogue.cpp
lib/src/CatalogueImpl.cpp
lib/src/Converter.cpp
lib/src/PgBinaryReader.cpp
lib/src/PgBinaryWriter.cpp
lib/src/PgFieldImpl.cpp
lib/src/PgFuncImpl.cpp
lib/src/PgReader.cpp
lib/src/PgTextReader.cpp
lib/src/PgTextWriter.cpp
lib/src/PgWriter.cpp)
target_sources(${PROJECT_NAME} PRIVATE
${public_headers}
${private_headers}
${PJ_SRC})
find_package(PostgreSQL REQUIRED)
target_link_libraries(${PROJECT_NAME} PRIVATE PostgreSQL::PostgreSQL)
include_directories(${PostgreSQL_INCLUDE_DIR})
find_package(nlohmann_json REQUIRED)
include_directories(${nlohmann_json_INCLUDE_DIR})
execute_process(COMMAND cat sql/get_meta.sql
WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}"
OUTPUT_VARIABLE META_SQL
OUTPUT_STRIP_TRAILING_WHITESPACE)
configure_file("${PROJECT_SOURCE_DIR}/cmake/templates/MetaSql.h.in"
"${PROJECT_SOURCE_DIR}/lib/src/MetaSql.h" @ONLY)
add_subdirectory(tests)