From 9c3d71d4b7846f23d5e0ba3161d69b738201bce2 Mon Sep 17 00:00:00 2001 From: Hennadii Stepanov <32963518+hebasto@users.noreply.github.com> Date: Tue, 9 Jan 2024 09:19:03 +0000 Subject: [PATCH 1/2] fixup! cmake: Build `univalue` static library --- src/univalue/CMakeLists.txt | 24 ++++++++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-) 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 +) From d554706aac96a224b78224ef500434855f416797 Mon Sep 17 00:00:00 2001 From: Hennadii Stepanov <32963518+hebasto@users.noreply.github.com> Date: Tue, 9 Jan 2024 09:17:31 +0000 Subject: [PATCH 2/2] fixup! cmake: Include CTest --- cmake/tests.cmake | 12 ++++++++++++ 1 file changed, 12 insertions(+) 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()