mirror of
https://github.com/curl/curl.git
synced 2026-06-22 15:05:38 +03:00
cm: add target prop processor logic
This commit is contained in:
parent
5596004115
commit
e8f52f0b4e
1 changed files with 36 additions and 16 deletions
|
|
@ -2252,7 +2252,41 @@ if(NOT CURL_DISABLE_INSTALL)
|
|||
endif()
|
||||
endforeach()
|
||||
|
||||
foreach(_libdir IN LISTS _custom_libdirs CURL_LIBDIRS)
|
||||
set(_explicit_libs "")
|
||||
set(_explicit_libdirs "")
|
||||
set(LIBCURL_PC_REQUIRES_PRIVATE "")
|
||||
foreach(_lib IN LISTS CURL_LIBS)
|
||||
if(TARGET "${_lib}")
|
||||
get_target_property(_imported "${_lib}" IMPORTED)
|
||||
if(NOT _imported)
|
||||
# Reading the LOCATION property on non-imported target will error out.
|
||||
# Assume the user will not need this information in the .pc file.
|
||||
continue()
|
||||
endif()
|
||||
get_target_property(_libname "${_lib}" LOCATION)
|
||||
if(_libname)
|
||||
list(APPEND _explicit_libs "${_libname}")
|
||||
else()
|
||||
get_target_property(_libs "${_lib}" INTERFACE_LINK_LIBRARIES)
|
||||
if(_libs)
|
||||
list(APPEND _explicit_libs "${_libs}")
|
||||
endif()
|
||||
get_target_property(_libdirs "${_lib}" INTERFACE_LINK_DIRECTORIES)
|
||||
if(_libdirs)
|
||||
list(APPEND _explicit_libdirs "${_libdirs}")
|
||||
endif()
|
||||
endif()
|
||||
if(NOT _libname AND NOT _libs AND NOT _libdirs)
|
||||
message(WARNING "Bad lib in library list: ${_lib}")
|
||||
endif()
|
||||
get_target_property(_modules "${_lib}" LIBCURL_PC_MODULES)
|
||||
if(_modules)
|
||||
list(APPEND LIBCURL_PC_REQUIRES_PRIVATE "${_modules}")
|
||||
endif()
|
||||
endif()
|
||||
endforeach()
|
||||
|
||||
foreach(_libdir IN LISTS _custom_libdirs _explicit_libdirs)
|
||||
if(CMAKE_VERSION VERSION_GREATER_EQUAL 3.20)
|
||||
cmake_path(SET _libdir NORMALIZE "${_libdir}")
|
||||
endif()
|
||||
|
|
@ -2267,21 +2301,7 @@ if(NOT CURL_DISABLE_INSTALL)
|
|||
set(_implicit_libs "${CMAKE_C_IMPLICIT_LINK_LIBRARIES}")
|
||||
endif()
|
||||
|
||||
foreach(_lib IN LISTS _implicit_libs _custom_libs CURL_LIBS)
|
||||
if(TARGET "${_lib}")
|
||||
set(_libname "${_lib}")
|
||||
get_target_property(_imported "${_libname}" IMPORTED)
|
||||
if(NOT _imported)
|
||||
# Reading the LOCATION property on non-imported target will error out.
|
||||
# Assume the user will not need this information in the .pc file.
|
||||
continue()
|
||||
endif()
|
||||
get_target_property(_lib "${_libname}" LOCATION)
|
||||
if(NOT _lib)
|
||||
message(WARNING "Bad lib in library list: ${_libname}")
|
||||
continue()
|
||||
endif()
|
||||
endif()
|
||||
foreach(_lib IN LISTS _implicit_libs _custom_libs _explicit_libs)
|
||||
if(_lib MATCHES "^-") # '-framework <name>'
|
||||
list(APPEND _ldflags "${_lib}")
|
||||
elseif(_lib MATCHES "/")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue