From 0127913ff9426fad1b73b7c5d6a17f688cfda797 Mon Sep 17 00:00:00 2001 From: scawful Date: Tue, 14 Oct 2025 22:53:14 -0400 Subject: [PATCH] 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. --- cmake/dependencies.cmake | 19 +++++-------------- 1 file changed, 5 insertions(+), 14 deletions(-) diff --git a/cmake/dependencies.cmake b/cmake/dependencies.cmake index f06ba4e4..efbbe6fe 100644 --- a/cmake/dependencies.cmake +++ b/cmake/dependencies.cmake @@ -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)