refactor(build): enhance CMake configurations for protobuf integration

- Updated CMake files to conditionally link against libprotobuf based on the YAZE_PROTOBUF_TARGET variable across various modules (core, net, agent, z3ed).
- Ensured consistent use of the static MSVC runtime to align with vcpkg static triplets.
- Improved clarity in build logs by adding status messages for whole-archive linking conditions.

Benefits:
- Enhances modularity and compatibility of the build system with protobuf.
- Streamlines the build process for different platforms by ensuring appropriate linking based on configuration options.
This commit is contained in:
scawful
2025-10-14 09:01:12 -04:00
parent a026207a2d
commit 01d3e46e87
17 changed files with 807 additions and 537 deletions

View File

@@ -48,9 +48,9 @@ if(YAZE_BUILD_TESTS)
if(MSVC)
target_link_options(${suite_name} PRIVATE /STACK:16777216)
# Force whole-archive linking for protobuf to ensure all symbols are included
if(YAZE_WITH_GRPC)
if(YAZE_WITH_GRPC AND YAZE_PROTOBUF_TARGET)
if(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
target_link_options(${suite_name} PRIVATE /WHOLEARCHIVE:$<TARGET_FILE:libprotobuf>)
target_link_options(${suite_name} PRIVATE /WHOLEARCHIVE:$<TARGET_FILE:${YAZE_PROTOBUF_TARGET}>)
else()
message(STATUS "○ Skipping /WHOLEARCHIVE for libprotobuf in ${suite_name} (clang-cl)")
endif()