Skip to content

Commit fbb1a68

Browse files
committed
st: fix reflectcpp consumer configure - find jansson for the Avro backend
CI (Lint and unit-test jobs) failed at CMake generate time with: The link interface of target "reflectcpp::reflectcpp" contains: jansson::jansson but the target was not found. With the avro feature on, reflect-cpp links the static avro-c archive, whose link interface carries jansson::jansson - but the upstream reflectcpp-config.cmake has no Avro find_dependency block, so the target is never defined in the consumer. The local macOS build didn't catch it because the only local consumer (StExamples) is an OBJECT library, which never links and so never triggers CMake's imported-target validation; a minimal linking-consumer reproduction fails identically to CI. Patch the installed config from the overlay portfile (gated on the avro feature) to find_dependency(jansson CONFIG) before including the exports, and bump the overlay to port-version 2 since the previously pushed content changed. Verified: the linking-consumer repro configures and links; the full local build and 83/83 pulsar-st-tests stay green. Signed-off-by: Matteo Merli <mmerli@apache.org>
1 parent 7bc64b9 commit fbb1a68

2 files changed

Lines changed: 11 additions & 1 deletion

File tree

vcpkg-overlay/reflectcpp/portfile.cmake

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,16 @@ vcpkg_cmake_config_fixup(
4545
CONFIG_PATH "lib/cmake/${PORT}"
4646
)
4747

48+
if("avro" IN_LIST FEATURES)
49+
# The Avro backend links the static avro-c archive, whose link interface
50+
# carries jansson::jansson — but the upstream config has no Avro
51+
# find_dependency block, so consumers fail at generate time with
52+
# "the target was not found". Define it before the exports are included.
53+
vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/share/${PORT}/${PORT}-config.cmake"
54+
"include(\${CMAKE_CURRENT_LIST_DIR}/reflectcpp-exports.cmake)"
55+
"include(CMakeFindDependencyMacro)\nfind_dependency(jansson CONFIG)\ninclude(\${CMAKE_CURRENT_LIST_DIR}/reflectcpp-exports.cmake)")
56+
endif()
57+
4858
file(REMOVE_RECURSE
4959
"${CURRENT_PACKAGES_DIR}/debug/include"
5060
"${CURRENT_PACKAGES_DIR}/debug/share"

vcpkg-overlay/reflectcpp/vcpkg.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "reflectcpp",
33
"version": "0.24.0",
4-
"port-version": 1,
4+
"port-version": 2,
55
"description": "A C++ library for serialization and deserialization using reflection. Supports JSON, Avro, BSON, Cap'n Proto, CBOR, CSV, flexbuffers, msgpack, parquet, TOML, UBJSON, XML, YAML.",
66
"homepage": "https://github.com/getml/reflect-cpp/",
77
"license": "MIT",

0 commit comments

Comments
 (0)