diff --git a/cmake/tests.cmake b/cmake/tests.cmake index ba73e7d32b4b..0215633e7780 100644 --- a/cmake/tests.cmake +++ b/cmake/tests.cmake @@ -55,3 +55,15 @@ if(TARGET test_bitcoin) add_all_test_targets() endif() + +if(TARGET unitester) + add_test(NAME univalue_test + COMMAND unitester + ) +endif() + +if(TARGET object) + add_test(NAME univalue_object_test + COMMAND object + ) +endif() diff --git a/src/univalue/CMakeLists.txt b/src/univalue/CMakeLists.txt index 796d3881b4cc..84a5d97ebe05 100644 --- a/src/univalue/CMakeLists.txt +++ b/src/univalue/CMakeLists.txt @@ -1,6 +1,6 @@ -# Copyright (c) 2023 The Bitcoin Core developers +# Copyright (c) 2023-present The Bitcoin Core developers # Distributed under the MIT software license, see the accompanying -# file COPYING or http://www.opensource.org/licenses/mit-license.php. +# file COPYING or https://opensource.org/license/mit/. add_library(univalue STATIC EXCLUDE_FROM_ALL lib/univalue.cpp @@ -8,10 +8,26 @@ add_library(univalue STATIC EXCLUDE_FROM_ALL lib/univalue_read.cpp lib/univalue_write.cpp ) - target_include_directories(univalue PUBLIC $ ) - target_link_libraries(univalue PRIVATE core_interface) + +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_executable(object test/object.cpp) +target_link_libraries(object + PRIVATE + core_interface + univalue +)