From d372fcded6390d396d116ee984c000983beecabc Mon Sep 17 00:00:00 2001 From: Alexey Edelev Date: Wed, 10 May 2023 09:18:14 -0700 Subject: [PATCH] CMake: Use the correct jsoncpp target name in static builds (#12733) When building protobuf with BUILD_SHARED_LIBS disabled, conformance_test_runner should link jsoncpp_static but not jsoncpp_lib. Closes #12733 COPYBARA_INTEGRATE_REVIEW=https://github.com/protocolbuffers/protobuf/pull/12733 from semlanik:main 2ab4be6bb0aa93020987702faa0dc3ece616edb7 PiperOrigin-RevId: 530926843 --- 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()