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:
@@ -95,7 +95,16 @@ else()
|
||||
endif()
|
||||
endif()
|
||||
|
||||
set(YAZE_PROTOBUF_WHOLEARCHIVE_TARGETS ${YAZE_PROTOBUF_TARGETS})
|
||||
# Filter WHOLEARCHIVE targets to only include libraries (not executables like protoc)
|
||||
set(YAZE_PROTOBUF_WHOLEARCHIVE_TARGETS)
|
||||
foreach(_proto_target IN LISTS YAZE_PROTOBUF_TARGETS)
|
||||
if(TARGET ${_proto_target})
|
||||
get_target_property(_target_type ${_proto_target} TYPE)
|
||||
if(_target_type MATCHES ".*_LIBRARY")
|
||||
list(APPEND YAZE_PROTOBUF_WHOLEARCHIVE_TARGETS ${_proto_target})
|
||||
endif()
|
||||
endif()
|
||||
endforeach()
|
||||
|
||||
if(YAZE_PROTOBUF_TARGETS)
|
||||
list(GET YAZE_PROTOBUF_TARGETS 0 YAZE_PROTOBUF_TARGET)
|
||||
|
||||
Reference in New Issue
Block a user