aboutsummaryrefslogtreecommitdiff
path: root/src/univalue/CMakeLists.txt
blob: 96733fe07725dde7fc5dd0d6092161b7cf88df1b (plain)
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
# Copyright (c) 2023-present The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or https://opensource.org/license/mit/.

add_library(univalue STATIC EXCLUDE_FROM_ALL
  lib/univalue.cpp
  lib/univalue_get.cpp
  lib/univalue_read.cpp
  lib/univalue_write.cpp
)
target_include_directories(univalue
  PUBLIC
    $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
)
target_link_libraries(univalue PRIVATE core_interface)

if(BUILD_TESTS)
  add_executable(unitester test/unitester.cpp)
  target_compile_definitions(unitester
    PRIVATE
      JSON_TEST_SRC=\"${CMAKE_CURRENT_SOURCE_DIR}/test\"
  )
  target_link_libraries(unitester
    PRIVATE
      core_interface
      univalue
  )
  add_test(NAME univalue_test
    COMMAND unitester
  )

  add_executable(object test/object.cpp)
  target_link_libraries(object
    PRIVATE
      core_interface
      univalue
  )
  add_test(NAME univalue_object_test
    COMMAND object
  )
endif()