diff --git a/tests/conformance/cpp/CMakeLists.txt b/tests/conformance/cpp/CMakeLists.txt index f892f66..2286f81 100644 --- a/tests/conformance/cpp/CMakeLists.txt +++ b/tests/conformance/cpp/CMakeLists.txt @@ -1,27 +1,34 @@ # Conformance runner, C++ side. Owned by lane PROTO. # -# Links libveloxproto (the generated protocol code in core/generated/), not libveloxcore: -# this exercises the wire types, which is a separate concern from the engine. See -# docs/adr/0009-generated-protocol-library.md. +# Links libveloxproto (the generated wire code, ADR 0009's velox::proto target), not +# libveloxcore: this exercises the wire types, which is a separate concern from the engine. +# +# Linking the same target GUI and daemon link — rather than compiling +# core/generated/velox_proto.cpp into a second executable with its own flag set — is what +# guarantees the conformance suite is checking byte-identical generated code to what the +# clients ship. Two compiles of one .cpp under two warning configs is exactly the skew a +# conformance suite exists to catch. -# The root CMakeLists.txt only find_package(nlohmann_json)'s when daemon/CMakeLists.txt -# exists (daemon is its real consumer), so this target may not exist yet when this -# directory configures on its own — this suite must not depend on daemon having landed. -# Self-sufficient rather than reaching into the root file to widen that guard. -if(NOT TARGET nlohmann_json::nlohmann_json) - find_package(nlohmann_json 3.11 REQUIRED) +if(TARGET velox::proto) + add_executable(velox_conformance_cpp conformance_main.cpp) + target_link_libraries(velox_conformance_cpp PRIVATE velox::proto) +else() + # Standalone configure of tests/conformance/ with no core/ in the tree: compile the + # generated source directly, as before the velox::proto target existed. Keeps the + # suite buildable on its own. + if(NOT TARGET nlohmann_json::nlohmann_json) + find_package(nlohmann_json 3.11 REQUIRED) + endif() + add_executable(velox_conformance_cpp + conformance_main.cpp + ${CMAKE_SOURCE_DIR}/core/generated/velox_proto.cpp) + target_include_directories(velox_conformance_cpp PRIVATE + ${CMAKE_SOURCE_DIR}/core/generated) + target_link_libraries(velox_conformance_cpp PRIVATE nlohmann_json::nlohmann_json) endif() -add_executable(velox_conformance_cpp - conformance_main.cpp - ${CMAKE_SOURCE_DIR}/core/generated/velox_proto.cpp) - -target_include_directories(velox_conformance_cpp PRIVATE - ${CMAKE_SOURCE_DIR}/core/generated - ${CMAKE_CURRENT_SOURCE_DIR}) - +target_include_directories(velox_conformance_cpp PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}) target_compile_features(velox_conformance_cpp PRIVATE cxx_std_23) -target_link_libraries(velox_conformance_cpp PRIVATE nlohmann_json::nlohmann_json) # The runner needs the repository root so it can find contracts/fixtures. add_test(NAME conformance_cpp