vcpkg/ports/curl/cmake-project-include.cmake
talregev 9911cb74a1
[curl] add psl feature (#38345)
<!-- If your PR fixes issues, please note that here by adding "Fixes
#NNNNNN." for each fixed issue on separate lines. -->

<!-- If you are still working on the PR, open it as a Draft:
https://github.blog/2019-02-14-introducing-draft-pull-requests/. -->


- [x] Changes comply with the [maintainer
guide](https://github.com/microsoft/vcpkg-docs/blob/main/vcpkg/contributing/maintainer-guide.md).
- [x] SHA512s are updated for each updated download.
- [x] The "supports" clause reflects platforms that may be fixed by this
new version.
- [x] Any fixed [CI
baseline](https://github.com/microsoft/vcpkg/blob/master/scripts/ci.baseline.txt)
entries are removed from that file.
- [x] Any patches that are no longer applied are deleted from the port's
directory.
- [x] The version database is fixed by rerunning `./vcpkg x-add-version
--all` and committing the result.
- [x] Only one version is added to each modified port's versions file.


<!-- If this PR adds a new port, please uncomment and fill out this
checklist:

- [ ] Changes comply with the [maintainer
guide](https://github.com/microsoft/vcpkg-docs/blob/main/vcpkg/contributing/maintainer-guide.md).
- [ ] The name of the port matches an existing name for this component
on https://repology.org/ if possible, and/or is strongly associated with
that component on search engines.
- [ ] Optional dependencies are resolved in exactly one way. For
example, if the component is built with CMake, all `find_package` calls
are REQUIRED, are satisfied by `vcpkg.json`'s declared dependencies, or
disabled with
[CMAKE_DISABLE_FIND_PACKAGE_Xxx](https://cmake.org/cmake/help/latest/variable/CMAKE_DISABLE_FIND_PACKAGE_PackageName.html).
- [ ] The versioning scheme in `vcpkg.json` matches what upstream says.
- [ ] The license declaration in `vcpkg.json` matches what upstream
says.
- [ ] The installed as the "copyright" file matches what upstream says.
- [ ] The source code of the component installed comes from an
authoritative source.
- [ ] The generated "usage text" is accurate. See
[adding-usage](https://github.com/microsoft/vcpkg-docs/blob/main/vcpkg/examples/adding-usage.md)
for context.
- [ ] The version database is fixed by rerunning `./vcpkg x-add-version
--all` and committing the result.
- [ ] Only one version is in the new port's versions file.
- [ ] Only one version is added to each modified port's versions file.

END OF NEW PORT CHECKLIST (delete this line) -->
2024-04-24 10:57:12 -04:00

90 lines
4.0 KiB
CMake

if(ANDROID AND ANDROID_NATIVE_API_LEVEL LESS 24)
# https://android.googlesource.com/platform/bionic/+/master/docs/32-bit-abi.md
set(HAVE_FILE_OFFSET_BITS FALSE CACHE INTERNAL "")
endif()
# Process the libs and targets in the variable named by `input`
# into a flat list of libs in the variable named by `output`.
# Simplify -framework elements.
# Use -l where possible.
# Avoid duplicates.
function(vcpkg_curl_flatten input output)
set(output_libs "${${output}}")
if(CMAKE_BUILD_TYPE STREQUAL "Debug")
string(REGEX REPLACE ";optimized;[^;]*|;debug" "" input_libs "VCPKG;${${input}}")
else()
string(REGEX REPLACE ";debug;[^;]*|;optimized" "" input_libs "VCPKG;${${input}}")
endif()
list(REMOVE_AT input_libs 0)
while(input_libs)
list(POP_BACK input_libs lib)
string(REGEX REPLACE "^.<LINK_ONLY:(.*)>\$" "\\1" lib "${lib}")
if(TARGET "${lib}")
set(import_lib "")
set(import_location "")
get_target_property(type "${lib}" TYPE)
if(NOT type STREQUAL "INTERFACE_LIBRARY")
if(CMAKE_BUILD_TYPE STREQUAL "Debug")
get_target_property(link_libs "${lib}" IMPORTED_LINK_INTERFACE_LIBRARIES_DEBUG)
get_target_property(import_lib "${lib}" IMPORTED_IMPLIB_DEBUG)
get_target_property(import_location "${lib}" IMPORTED_LOCATION_DEBUG)
else()
get_target_property(link_libs "${lib}" IMPORTED_LINK_INTERFACE_LIBRARIES_RELEASE)
get_target_property(import_lib "${lib}" IMPORTED_IMPLIB_RELEASE)
get_target_property(import_location "${lib}" IMPORTED_LOCATION_RELEASE)
endif()
if(link_libs)
vcpkg_curl_flatten(link_libs output_libs)
endif()
get_target_property(link_libs "${lib}" IMPORTED_LINK_INTERFACE_LIBRARIES)
if(link_libs)
vcpkg_curl_flatten(link_libs output_libs)
endif()
if(NOT import_lib)
get_target_property(import_lib "${lib}" IMPORTED_IMPLIB)
endif()
if(NOT import_location)
get_target_property(import_location "${lib}" IMPORTED_LOCATION)
endif()
endif()
get_target_property(link_libs "${lib}" INTERFACE_LINK_LIBRARIES)
if(link_libs)
vcpkg_curl_flatten(link_libs output_libs)
endif()
if(import_lib)
set(lib "${import_lib}")
elseif(import_location)
set(lib "${import_location}")
endif()
endif()
if(lib MATCHES "^(.*)/([^/]*)[.]framework$")
if(CMAKE_MATCH_1 IN_LIST CMAKE_C_IMPLICIT_LINK_FRAMEWORK_DIRECTORIES)
set(lib "-framework ${CMAKE_MATCH_2}")
else()
set(lib "-framework ${lib}")
endif()
elseif(WIN32 AND lib MATCHES ".*/${CMAKE_IMPORT_LIBRARY_PREFIX}([^/]*)${CMAKE_IMPORT_LIBRARY_SUFFIX}")
set(lib -l${CMAKE_MATCH_1})
elseif(lib MATCHES ".*/${CMAKE_STATIC_LIBRARY_PREFIX}([^/]*)${CMAKE_STATIC_LIBRARY_SUFFIX}")
set(lib -l${CMAKE_MATCH_1})
elseif(lib MATCHES ".*/${CMAKE_SHARED_LIBRARY_PREFIX}([^/]*)${CMAKE_SHARED_LIBRARY_SUFFIX}")
set(lib -l${CMAKE_MATCH_1})
endif()
if(NOT "${lib}" IN_LIST output_libs)
list(PREPEND output_libs "${lib}")
endif()
endwhile()
set("${output}" "${output_libs}" PARENT_SCOPE)
endfunction()
if(NOT CURL_DISABLE_LDAP AND NOT WIN32)
find_package(PkgConfig REQUIRED)
pkg_check_modules(LDAP REQUIRED ldap)
set(HAVE_LIBLDAP 1)
set(CMAKE_LDAP_INCLUDE_DIR "${LDAP_INCLUDE_DIRS}")
set(CMAKE_LDAP_LIB "${LDAP_LINK_LIBRARIES}" CACHE STRING "")
pkg_check_modules(LBER REQUIRED lber)
set(HAVE_LIBLBER 1)
set(CMAKE_LBER_LIB "${LBER_LINK_LIBRARIES}" CACHE STRING "")
endif()