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

@@ -42,7 +42,9 @@ if(YAZE_WITH_GRPC)
target_link_libraries(z3ed PRIVATE grpc++ grpc++_reflection libprotobuf)
# On Windows, force whole-archive linking for protobuf to ensure all symbols are included
if(MSVC)
target_link_options(z3ed PRIVATE /WHOLEARCHIVE:$<TARGET_FILE:libprotobuf>)
endif()
endif()
if(MSVC AND CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
target_link_options(z3ed PRIVATE /WHOLEARCHIVE:$<TARGET_FILE:libprotobuf>)
elseif(MSVC)
message(STATUS "○ Skipping /WHOLEARCHIVE for libprotobuf in z3ed (clang-cl)")
endif()
endif()