chore: refine protobuf linking logic for Windows builds
- Enhanced CMake configuration to conditionally apply /WHOLEARCHIVE linking for protobuf targets, ensuring only library targets are included. - Updated linking logic across multiple components including `yaze`, `yaze_emu`, `z3ed`, and test suites to improve compatibility and prevent linker errors. Benefits: - Increases build stability and clarity by ensuring only relevant targets are linked, reducing potential conflicts during the build process.
This commit is contained in:
@@ -50,7 +50,12 @@ foreach(TOOL ${HELPER_TOOLS})
|
||||
# Windows: Link protobuf with /WHOLEARCHIVE (not via yaze_core to avoid LNK1241)
|
||||
if(WIN32 AND MSVC AND YAZE_WITH_GRPC AND YAZE_PROTOBUF_WHOLEARCHIVE_TARGETS)
|
||||
foreach(_yaze_proto_target IN LISTS YAZE_PROTOBUF_WHOLEARCHIVE_TARGETS)
|
||||
target_link_options(${TOOL} PRIVATE /WHOLEARCHIVE:$<TARGET_FILE:${_yaze_proto_target}>)
|
||||
if(TARGET ${_yaze_proto_target})
|
||||
get_target_property(_target_type ${_yaze_proto_target} TYPE)
|
||||
if(_target_type MATCHES ".*_LIBRARY")
|
||||
target_link_options(${TOOL} PRIVATE /WHOLEARCHIVE:$<TARGET_FILE:${_yaze_proto_target}>)
|
||||
endif()
|
||||
endif()
|
||||
endforeach()
|
||||
elseif(YAZE_WITH_GRPC AND YAZE_PROTOBUF_TARGETS)
|
||||
target_link_libraries(${TOOL} PRIVATE ${YAZE_PROTOBUF_TARGETS})
|
||||
|
||||
Reference in New Issue
Block a user