From 2ab4be6bb0aa93020987702faa0dc3ece616edb7 Mon Sep 17 00:00:00 2001 From: Alexey Edelev Date: Tue, 9 May 2023 17:05:21 +0200 Subject: [PATCH] CMake: Use the correct jsoncpp target name in static builds When building protobuf with BUILD_SHARED_LIBS disabled, conformance_test_runner should link jsoncpp_static but not jsoncpp_lib. --- cmake/conformance.cmake | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/cmake/conformance.cmake b/cmake/conformance.cmake index 6ba9050af7eb..d727ea8122f0 100644 --- a/cmake/conformance.cmake +++ b/cmake/conformance.cmake @@ -90,7 +90,11 @@ set(JSONCPP_WITH_TESTS OFF CACHE BOOL "Disable tests") if(protobuf_JSONCPP_PROVIDER STREQUAL "module") add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/third_party/jsoncpp third_party/jsoncpp) target_include_directories(conformance_test_runner PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/third_party/jsoncpp/include) - target_link_libraries(conformance_test_runner jsoncpp_lib) + if(BUILD_SHARED_LIBS) + target_link_libraries(conformance_test_runner jsoncpp_lib) + else() + target_link_libraries(conformance_test_runner jsoncpp_static) + endif() else() target_link_libraries(conformance_test_runner jsoncpp) endif()