refactor(build): enhance MSVC whole-archive linking for protobuf

- Updated CMake configurations across core, net, agent, and z3ed to conditionally apply /WHOLEARCHIVE linking for libprotobuf based on the compiler ID.
- Added status messages to indicate when /WHOLEARCHIVE linking is skipped for clang-cl, improving clarity in build logs.

Benefits:
- Improves compatibility and clarity in the build process for Windows environments using different compilers.
- Ensures that necessary symbols are included when using MSVC, enhancing build reliability.
This commit is contained in:
scawful
2025-10-13 23:11:06 -04:00
parent 7bb0f257ce
commit cafa50b355
5 changed files with 23 additions and 11 deletions

View File

@@ -164,8 +164,10 @@ if(YAZE_WITH_GRPC)
)
# On Windows, force whole-archive linking for protobuf to ensure all symbols are included
if(MSVC)
if(MSVC AND CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
target_link_options(yaze_agent PUBLIC /WHOLEARCHIVE:$<TARGET_FILE:libprotobuf>)
elseif(MSVC)
message(STATUS "○ Skipping /WHOLEARCHIVE for libprotobuf (clang-cl)")
endif()
# Note: YAZE_WITH_GRPC is defined globally via add_compile_definitions in root CMakeLists.txt