Repository navigation
Backlog
Labels
bugSomething isn't workingknown-downstream-workaroundsDownstream consumer pain or workaround observed in real-world OSS reposneeds-triageMaintainer needs to evaluate this issue
Description
Part of #138
Popularity: 5/7 corpus consumers (cuda-quantum, holoscan-sdk, fanuc-libs, wolf, slang-server)
Problem
Consuming the upstream reflectcpp CMake target directly in strict or multi-target builds triggers multiple build-hygiene and linkage issues:
- Public/interface include directories are not exported as
SYSTEM, leaking third-party warnings into consumer-Werrorbuilds and forcing per-targetSYSTEMre-declarations or directory-wide-whacks. reflect-cpp's own compiled sources inherit parent directory warning flags (triggering-Wmissing-field-initializers,-Wunused-parameter, Clang 19+-Wmissing-template-arg-list-after-template-kw) and do not isolateCOMPILE_WARNING_AS_ERROR,CXX_CLANG_TIDY,POSITION_INDEPENDENT_CODE, or hidden symbol visibility (CXX_VISIBILITY_PRESET hidden/VISIBILITY_INLINES_HIDDEN ON) when statically embedded into shared libraries.- Bundled
yyjsonsymbols are compiled with default ELF visibility (yyjson_api), and a consumer that already builds its ownyyjsonobject cannot share that single hidden-visibilityyyjsonobject with thereflectcppCMake target without duplicate symbols or target-bypassing workarounds.
Observed Downstream Workarounds
NVIDIA/cuda-quantum (90e4aa08)
cudaq/lib/Target/cmake/FetchDependencies.cmake#L77-L89: manually overrides five target properties post-FetchContent_MakeAvailableto keepreflectcppheaders out of root-Werrorand symbols hidden insideCUDAQTargetCatalog:set_target_properties(${_cudaq_target_dep} PROPERTIES POSITION_INDEPENDENT_CODE ON COMPILE_WARNING_AS_ERROR OFF SYSTEM ON CXX_VISIBILITY_PRESET hidden VISIBILITY_INLINES_HIDDEN ON)
nvidia-holoscan/holoscan-sdk (358c772f)
CMakeLists.txt#L527-L568: completely bypasses thereflectcppCMake target and manually compiles${reflectcpp_SOURCE_DIR}/src/reflectcpp.cppandsrc/reflectcpp_json.cppinto a customOBJECTlibrary (holoscan_config_reflect_private_objects) with:target_compile_definitions(... PRIVATE yyjson_api=)soyyjsonhonors hidden ELF visibilitySYSTEM PRIVATEinclude directories (includeandinclude/rfl/thirdparty)CXX_CLANG_TIDY ""andPOSITION_INDEPENDENT_CODE ON- Reuse of Holoscan's single
holoscan_config_yyjson_private_objects(yyjson.c) instead ofreflect-cpp's bundled copy.
FANUC-CORPORATION/fanuc_driver (da5db3f6)
fanuc_libs/CMakeLists.txt#L54-L58: forcesPOSITION_INDEPENDENT_CODE ONon staticreflectcpppost-FetchContentso it can be linkedPRIVATEinto installed ROS 2SHAREDlibraries:set(REFLECTCPP_BUILD_SHARED OFF CACHE BOOL "Build reflectcpp as a shared library") set(REFLECTCPP_YAML ON CACHE BOOL "Enable YAML support") FetchContent_MakeAvailable(reflect-cpp) set_target_properties(reflectcpp PROPERTIES CXX_STANDARD 20) set_target_properties(reflectcpp PROPERTIES POSITION_INDEPENDENT_CODE ON)
- Both
fanuc_libs/gpio_config/CMakeLists.txt#L9-L10andfanuc_libs/rmi/CMakeLists.txt#L9-L10buildSHAREDlibraries that privately absorb the staticreflectcpparchive:add_library(gpio_config SHARED src/gpio_config.cpp ) target_link_libraries(gpio_config PRIVATE reflectcpp)
add_library(rmi SHARED src/rmi.cpp src/serialization.cpp src/deserialization.cpp) target_link_libraries(rmi PRIVATE reflectcpp Sockpp::sockpp)
- Furthermore,
fanuc_hardware_interface/CMakeLists.txt#L27-L35links bothfanuc_libs::rmiandfanuc_libs::gpio_configinto the samelibfanuc_robot_driver.soplugin, meaning both shared libraries embed default-visibilityreflectcpp+ bundledyyjsonsymbols in the same process.
games-on-whales/wolf (ac2461f6)
- Directory-wide
-wtoggle aroundFetchContent_MakeAvailable(reflect-cpp):
Whilewolfimports nearly every other fetched library (fmt,eventbus,simple-web-server,mdns_cpp,enet,ICU::uc) through a customtarget_link_libraries_systemhelper (cmake/TargetLinkLibrariesSystem.cmake#L1-L31), forreflect-cppit saves and overwritesCOMPILE_OPTIONSwith-wbefore fetching and restores it afterwards (src/moonlight-server/CMakeLists.txt#L37-L61, introduced in commit1d7ba8f9):# A nice little trick to disable warnings for external dependencies # see: https://stackoverflow.com/a/76128930 get_directory_property(old_dir_compile_options COMPILE_OPTIONS) add_compile_options(-w) # Serialization FetchContent_Declare( reflect-cpp GIT_REPOSITORY https://github.com/getml/reflect-cpp GIT_TAG v0.21.0 ) ... FetchContent_MakeAvailable(reflect-cpp) target_link_libraries(wolf_runner PUBLIC reflectcpp) # Restore warnings set_directory_properties(PROPERTIES COMPILE_OPTIONS "${old_dir_compile_options}")
- Global Clang 19+ warning-suppression flag in Docker build:
Indocker/wolf.Dockerfile#L56-L66(line 61, added in commit40d43716"fix: docker build with latest clangd 19 breaks reflect-cpp", explicitly citinggetml/reflect-cpp#221):-DCMAKE_CXX_FLAGS="-Wno-missing-template-arg-list-after-template-kw" ```
hudson-trading/slang-server (1b413a46)
slang-server compiles its own code with -Wall -Wextra -Wpedantic -Werror (CMakeLists.txt#L156-L162, CMakeLists.txt#L391-L405). Integrating reflect-cpp via add_subdirectory(external/reflect-cpp) requires patching both the reflectcpp target itself and every consumer target:
- Injecting warning suppressions onto
reflectcpp(CMakeLists.txt#L317-L321):# Suppress warnings in reflect-cpp library if(CMAKE_CXX_COMPILER_ID MATCHES "GNU|Clang") target_compile_options(reflectcpp PRIVATE -Wno-missing-field-initializers -Wno-unused-parameter -fexceptions) endif()
- Re-declaring
external/reflect-cpp/includeasSYSTEMon 3 separate targets — including targets that already linkreflectcpp:CMakeLists.txt#L378-L379:target_include_directories(slang_server_obj_lib SYSTEM PRIVATE external/reflect-cpp/include)
CMakeLists.txt#L418-L420:target_include_directories(gen_config_schema SYSTEM PRIVATE external/reflect-cpp/include) target_link_libraries(gen_config_schema PRIVATE reflectcpp)
tests/cpp/CMakeLists.txt#L14-L17:target_include_directories( server_unittests SYSTEM PRIVATE ${PROJECT_SOURCE_DIR}/external/reflect-cpp/include) target_link_libraries(server_unittests PRIVATE reflectcpp)
Related Fork Work
- CMake: export reflectcpp and pugixml include directories as SYSTEM #113 (closed; parked in Map (Backlog — Easy & Landable / Parked for After Main Effort) #116) / CMake: mark reflectcpp PUBLIC include directories as SYSTEM to avoid leaking third-party warnings #111 — CMake: export
reflectcppandpugixmlinclude directories asSYSTEM. - Map (Lane 1): Core Hygiene & Perf #85 — Map (Lane 1): Core Hygiene & Perf (tracks CMake: export reflectcpp and pugixml include directories as SYSTEM #113 and upstream PR
#803strict public-header warnings). - Still unaddressed beyond CMake: export reflectcpp and pugixml include directories as SYSTEM #113: configurable/external
yyjsonobject reuse +yyjson_api=visibility control, PIC/hidden visibility ergonomics for embedded static targets, warning-cleanreflectcppsources under-Wall -Wextra/ Clang 19+, andCXX_CLANG_TIDY/COMPILE_WARNING_AS_ERRORisolation.
Upstream Overlap
- Fix -Wextra, -Wextra-semi, -Wsign-conversion, and -Wunused-parameter warnings in public headers munich-data-engineering/reflect-cpp#803 (open PR, partial) — Fixes
-Wextra,-Wextra-semi,-Wsign-conversion,-Wunused-parameter, and-Wmissing-field-initializerswarnings in public headers. - Add CMake option for toggling strict warnings munich-data-engineering/reflect-cpp#620 (merged, partial) — Adds
REFLECTCPP_STRICT_WARNINGSCMake option (defaultOFF, post-v0.21/v0.23) to stop forcing-Wallonto consumers. - Needs to add -Wno-missing-template-arg-list-after-template-kw to compile with clang19 munich-data-engineering/reflect-cpp#221 (closed/fixed, partial) — Clang 19
-Wmissing-template-arg-list-after-template-kwin bundled CTRE (explicitly cited bywolfonv0.21.0; resolved by CTRE updates in Using current CTRE (6cd1fdc) https://github.com/hanickadot/compile-ti… munich-data-engineering/reflect-cpp#233 and Added a test for UUIDv4; upgraded CTRE to 3.10; fixed issue #486 munich-data-engineering/reflect-cpp#487). - External yyjson and REFLECTCPP_USE_BUNDLED_DEPENDENCIES=OFF does not work munich-data-engineering/reflect-cpp#433 (closed/completed, partial) — External
yyjsontarget-name mismatch (yyjson::yyjsonvsyyjson) underREFLECTCPP_USE_BUNDLED_DEPENDENCIES=OFF; maintainer pointed to vcpkg/Conan conventions and userALIASworkaround. - Unfiled upstream:
SYSTEMinclude directories, PIC, hidden symbol visibility,yyjson_api=ELF visibility / sharedyyjsonobject reuse, andCXX_CLANG_TIDY/COMPILE_WARNING_AS_ERRORisolation.
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingknown-downstream-workaroundsDownstream consumer pain or workaround observed in real-world OSS reposneeds-triageMaintainer needs to evaluate this issue
Activity
[-]Build/CMake: reflectcpp target lacks SYSTEM headers, visibility/PIC/linter isolation, and collides on bundled yyjson[/-][+]Build/CMake: reflectcpp target lacks SYSTEM headers, warning/visibility/PIC/linter isolation, and collides on bundled yyjson[/+]clockblocker commentedon Nov 29, 2026
Tracking & PR Cross-Reference
Status: Partially addressed (
upstream-queueDraft PR #191 for public-header warnings;upstream-queue-for-build-cmakein progress for CMake hygiene).upstream-queue):munich-data-engineering/reflect-cpp#803/ fork PR Fix -Wextra, -Wextra-semi, -Wsign-conversion, and -Wunused-parameter warnings in public headers #55 (Fix-Wextra,-Wextra-semi,-Wsign-conversion, and-Wunused-parameterwarnings in public headers) → Rank Accept grouped short options and abbreviated long options in rfl::cli #5 in Draft PR Upstream PR Queue (sorted by mergeability score) #191 (commit07ef2b6e, score 92/100).upstream-queue-for-build-cmake):reflectcppandpugixmlinclude directories asSYSTEM, resolved onshowcase/all-lanes; merged CMake: mark reflectcpp PUBLIC include directories as SYSTEM to avoid leaking third-party warnings #111).SYSTEMinclude dirs, PIC, symbol visibility,clang-tidy/ linter isolation, and bundledyyjsoncollision handling) is being implemented onupstream-queue-for-build-cmakealongside Build/CMake: dev-only vcpkg git submodule fetched by default under FetchContent, CPM, and recursive git submodules #139, Build/CMake: format opt-in boilerplate, implicit yaml-cpp/tomlplusplus FetchContent ordering, and silent REFLECTCPP_USE_VCPKG=ON #142, Build/CMake: cmake_minimum_required(VERSION 3.23) blocks Ubuntu 22.04 / RHEL 8 / ROS 2 Humble (CMake 3.20–3.22) #156, and Build/CMake: reflectcpp target omits target_compile_features(cxx_std_20), breaking C++17 parent builds #157.build(cmake): mark subproject interface includes SYSTEM and isolate w…
build(cmake): isolate bundled yyjson visibility, support external yyj…
build(cmake): mark subproject interface includes SYSTEM and isolate w…
build(cmake): isolate bundled yyjson visibility, support external yyj…
build(cmake): mark subproject interface includes SYSTEM and isolate w…
build(cmake): isolate bundled yyjson visibility, support external yyj…
build(cmake): mark subproject interface includes SYSTEM and isolate w…
build(cmake): isolate bundled yyjson visibility, support external yyj…