refactor(cmake): simplify Protobuf target handling in dependencies.cmake

- Refactored the logic for appending Protobuf targets to streamline the configuration.
- Removed unnecessary checks and consolidated target handling for improved clarity and maintainability.
- Introduced YAZE_PROTOBUF_WHOLEARCHIVE_TARGETS to facilitate linking without "lite" variants.

Benefits:
- Enhances the organization of CMake configurations, leading to a more efficient build process.
This commit is contained in:
scawful
2025-10-14 22:53:14 -04:00
parent 2f84879ca9
commit 0127913ff9

View File

@@ -89,15 +89,13 @@ set(YAZE_PROTOBUF_TARGETS)
if(TARGET protobuf::libprotobuf)
list(APPEND YAZE_PROTOBUF_TARGETS protobuf::libprotobuf)
elseif(TARGET libprotobuf)
list(APPEND YAZE_PROTOBUF_TARGETS libprotobuf)
else()
if(TARGET libprotobuf)
list(APPEND YAZE_PROTOBUF_TARGETS libprotobuf)
endif()
endif()
if(TARGET protobuf::libprotobuf-lite)
list(APPEND YAZE_PROTOBUF_TARGETS protobuf::libprotobuf-lite)
elseif(TARGET libprotobuf-lite)
list(APPEND YAZE_PROTOBUF_TARGETS libprotobuf-lite)
endif()
set(YAZE_PROTOBUF_WHOLEARCHIVE_TARGETS ${YAZE_PROTOBUF_TARGETS})
if(YAZE_PROTOBUF_TARGETS)
list(GET YAZE_PROTOBUF_TARGETS 0 YAZE_PROTOBUF_TARGET)
@@ -105,13 +103,6 @@ else()
set(YAZE_PROTOBUF_TARGET "")
endif()
set(YAZE_PROTOBUF_WHOLEARCHIVE_TARGETS)
foreach(_yaze_proto_candidate IN LISTS YAZE_PROTOBUF_TARGETS)
if(NOT _yaze_proto_candidate MATCHES "lite")
list(APPEND YAZE_PROTOBUF_WHOLEARCHIVE_TARGETS ${_yaze_proto_candidate})
endif()
endforeach()
# SDL2
include(cmake/sdl2.cmake)