refactor(cmake): enhance Protobuf target handling for MSVC

- Introduced YAZE_PROTOBUF_WHOLEARCHIVE_TARGETS to streamline linking of Protobuf targets, excluding "lite" variants.
- Updated CMake configurations across various components (yaze, yaze_core_lib, yaze_editor, yaze_net, yaze_agent, z3ed) to utilize the new whole-archive targets for MSVC builds.
- Improved test suite linking to ensure all Protobuf symbols are included during the build process.

Benefits:
- Enhances compatibility and maintainability of Protobuf linking, leading to a more robust build configuration.
This commit is contained in:
scawful
2025-10-14 22:22:00 -04:00
parent 0113d78978
commit 0b72b56594
8 changed files with 21 additions and 14 deletions

View File

@@ -48,8 +48,8 @@ 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 AND YAZE_PROTOBUF_TARGETS)
foreach(_yaze_proto_target IN LISTS YAZE_PROTOBUF_TARGETS)
if(YAZE_WITH_GRPC AND MSVC AND YAZE_PROTOBUF_WHOLEARCHIVE_TARGETS)
foreach(_yaze_proto_target IN LISTS YAZE_PROTOBUF_WHOLEARCHIVE_TARGETS)
target_link_options(${suite_name} PRIVATE /WHOLEARCHIVE:$<TARGET_FILE:${_yaze_proto_target}>)
endforeach()
endif()