forked from Bitcoin-ABC/bitcoin-abc
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathCMakeLists.txt
54 lines (43 loc) · 1.4 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
# Copyright (c) 2017 The Bitcoin developers
cmake_minimum_required(VERSION 3.5)
project(univalue)
option(UNIVALUE_BUILD_TESTS "Build univalue's unit tests" ON)
# TODO: Version info
add_library(univalue
lib/univalue.cpp
lib/univalue_get.cpp
lib/univalue_read.cpp
lib/univalue_write.cpp
)
target_include_directories(univalue
PUBLIC
include
PRIVATE
lib
)
if(UNIVALUE_BUILD_TESTS)
include(TestSuite)
create_test_suite(univalue)
function(create_univalue_test NAME FILES)
add_test_to_suite(univalue ${NAME} ${FILES})
target_link_libraries(${NAME} univalue)
endfunction()
create_univalue_test(unitester_test test/unitester.cpp)
target_compile_definitions(unitester_test
PUBLIC JSON_TEST_SRC="${PROJECT_SOURCE_DIR}/test"
)
create_univalue_test(no_nul_test test/no_nul.cpp)
create_univalue_test(object_test test/object.cpp)
# test_json is not meant to run in an automated test suite.
add_executable(json_test EXCLUDE_FROM_ALL test/test_json.cpp)
target_link_libraries(json_test univalue)
add_dependencies(check-univalue json_test)
endif(UNIVALUE_BUILD_TESTS)
# Generate lib/univalue_escapes.h
include(NativeExecutable)
add_native_executable(univalue_gen gen/gen.cpp)
native_target_include_directories(univalue_gen PUBLIC include)
# Custom target to regenerate univalue_escapes.h
add_custom_target(generate_univalue_escapes_h
COMMAND univalue_gen > ${CMAKE_CURRENT_SOURCE_DIR}/lib/univalue_escapes.h
)