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:
@@ -46,7 +46,12 @@ if(YAZE_BUILD_TESTS)
|
||||
# Link protobuf with /WHOLEARCHIVE on Windows (instead of via libraries)
|
||||
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(${suite_name} 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(${suite_name} PRIVATE /WHOLEARCHIVE:$<TARGET_FILE:${_yaze_proto_target}>)
|
||||
endif()
|
||||
endif()
|
||||
endforeach()
|
||||
endif()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user