From c4f39f2be8109fd1a3e047677c09cf47954b92db Mon Sep 17 00:00:00 2001 From: WenTao Ou Date: Tue, 9 Jan 2024 04:27:46 +0800 Subject: [PATCH] [BUILD] Skip patch alias target (#2457) --- cmake/patch-imported-config.cmake | 7 +++++-- cmake/tools.cmake | 16 +++++++++++++++- 2 files changed, 20 insertions(+), 3 deletions(-) diff --git a/cmake/patch-imported-config.cmake b/cmake/patch-imported-config.cmake index ec68d74099..a2d22ed398 100644 --- a/cmake/patch-imported-config.cmake +++ b/cmake/patch-imported-config.cmake @@ -21,8 +21,11 @@ if(TARGET c-ares::cares) endif() # curl targets -if(TARGET CURL::libcurl) - project_build_tools_patch_default_imported_config(CURL::libcurl) +if(TARGET CURL::libcurl + OR TARGET CURL::libcurl_static + OR TARGET CURL::libcurl_shared) + project_build_tools_patch_default_imported_config( + CURL::libcurl CURL::libcurl_static CURL::libcurl_shared) endif() # abseil targets diff --git a/cmake/tools.cmake b/cmake/tools.cmake index ee191121ca..43c1a7b43f 100644 --- a/cmake/tools.cmake +++ b/cmake/tools.cmake @@ -14,7 +14,16 @@ endmacro() if(NOT PATCH_PROTOBUF_SOURCES_OPTIONS_SET) if(MSVC) unset(PATCH_PROTOBUF_SOURCES_OPTIONS CACHE) - set(PATCH_PROTOBUF_SOURCES_OPTIONS /wd4244 /wd4251 /wd4267 /wd4309 /wd4668 /wd4946 /wd6001 /wd6244 /wd6246) + set(PATCH_PROTOBUF_SOURCES_OPTIONS + /wd4244 + /wd4251 + /wd4267 + /wd4309 + /wd4668 + /wd4946 + /wd6001 + /wd6244 + /wd6246) if(MSVC_VERSION GREATER_EQUAL 1922) # see @@ -147,6 +156,11 @@ function(project_build_tools_patch_default_imported_config) continue() endif() + get_target_property(IS_ALIAS_TARGET ${TARGET_NAME} ALIASED_TARGET) + if(IS_ALIAS_TARGET) + continue() + endif() + if(CMAKE_VERSION VERSION_LESS "3.19.0") get_target_property(TARGET_TYPE_NAME ${TARGET_NAME} TYPE) if(TARGET_TYPE_NAME STREQUAL "INTERFACE_LIBRARY")