-
Notifications
You must be signed in to change notification settings - Fork 3
/
CMakeLists.txt
87 lines (74 loc) · 1.98 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
84
85
86
87
cmake_minimum_required(VERSION 3.2)
project(snapshot-validator)
set(ENV{PKG_CONFIG_PATH} "${CMAKE_CURRENT_SOURCE_DIR}/external/libpqxx-installation/lib/pkgconfig:$ENV{PKG_CONFIG_PATH}")
find_package(PkgConfig REQUIRED)
pkg_search_module(PQ REQUIRED libpq)
pkg_search_module(PQXX REQUIRED libpqxx)
pkg_search_module(SODIUM REQUIRED libsodium)
include_directories(
${PQ_INCLUDE_DIRS}
${PQXX_INCLUDE_DIRS}
${SODIUM_INCLUDE_DIRS}
${CMAKE_CURRENT_SOURCE_DIR}/external/utfcpp/source
)
message(${PQ_LIBRARIES} ${PQXX_LIBRARIES})
set(CMAKE_CXX_STANDARD 14)
set(MAIN_EXECUTABLE "validate-snapshot-database")
set(TESTS_EXECUTABLE "tests")
add_library(lib
lib/types.h
lib/lisk.cpp
lib/transaction.cpp
lib/transaction_validator.cpp
)
target_include_directories(lib PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/lib>)
install(TARGETS lib
EXPORT lib
ARCHIVE DESTINATION lib
INCLUDES DESTINATION include
)
install(
DIRECTORY lib/
DESTINATION include
FILES_MATCHING PATTERN "*.h"
)
add_executable(${MAIN_EXECUTABLE}
src/assets.cpp
src/blockchain_state.cpp
src/blockchain_state_validator.cpp
src/block.h
src/block.cpp
src/block_validator.cpp
src/log.cpp
src/main.cpp
src/payload.cpp
src/summaries.cpp
src/settings.cpp
)
target_link_libraries(${MAIN_EXECUTABLE}
PUBLIC
lib
${PQXX_LDFLAGS}
${PQ_LDFLAGS}
# Shared library: ${SODIUM_LDFLAGS}
# Static library: ${SODIUM_LIBDIR}/libsodium.a
${SODIUM_LIBDIR}/libsodium.a
)
install(TARGETS ${MAIN_EXECUTABLE}
RUNTIME DESTINATION bin
)
add_executable(${TESTS_EXECUTABLE}
tests/main.cpp
tests/transaction.cpp
)
target_link_libraries(${TESTS_EXECUTABLE}
PUBLIC
lib
${PQXX_LDFLAGS}
${PQ_LDFLAGS}
# Shared library: ${SODIUM_LDFLAGS}
# Static library: ${SODIUM_LIBDIR}/libsodium.a
${SODIUM_LIBDIR}/libsodium.a
)
enable_testing()
add_test(all_tests ${TESTS_EXECUTABLE})