Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mitigate FindPkgConfig.cmake framework handling bug #35893

Closed
wants to merge 2 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
25 changes: 25 additions & 0 deletions scripts/buildsystems/vcpkg.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -857,6 +857,31 @@ macro("${VCPKG_OVERRIDE_FIND_PACKAGE_NAME}" z_vcpkg_find_package_package_name)
_find_package(gRPC ${z_vcpkg_find_package_${z_vcpkg_find_package_backup_id}_ARGN})
else()
_find_package("${z_vcpkg_find_package_package_name}" ${z_vcpkg_find_package_${z_vcpkg_find_package_backup_id}_ARGN})
# Until CMake 3.29, https://gitlab.kitware.com/cmake/cmake/-/merge_requests/9109
if(APPLE AND COMMAND _pkgconfig_extract_frameworks AND NOT COMMAND __pkgconfig_extract_frameworks)
# Fix wrong cache setup/reuse
macro(_pkgconfig_extract_frameworks _prefix)
__pkgconfig_extract_frameworks("${_prefix}")
if(NOT "${${_prefix}_LIBRARIES}" STREQUAL "$CACHE{${_prefix}_LIBRARIES}")
set(${_prefix}_LIBRARIES "${${_prefix}_LIBRARIES}" CACHE INTERNAL "")
endif()
if(NOT "${${_prefix}_LDFLAGS_OTHER}" STREQUAL "$CACHE{${_prefix}_LDFLAGS_OTHER}")
set(${_prefix}_LDFLAGS_OTHER "${${_prefix}_LDFLAGS_OTHER}" CACHE INTERNAL "")
endif()
endmacro()
endif()
if(COMMAND _pkgconfig_extract_isystem AND NOT COMMAND __pkgconfig_extract_isystem)
# Fix wrong cache setup/reuse
macro(_pkgconfig_extract_isystem _prefix)
__pkgconfig_extract_isystem("${_prefix}")
if(NOT "${${_prefix}_CFLAGS_OTHER}" STREQUAL "$CACHE{${_prefix}_CFLAGS_OTHER}")
set(${_prefix}_CFLAGS_OTHER "${${_prefix}_CFLAGS_OTHER}" CACHE INTERNAL "")
endif()
if(NOT "${${_prefix}_INCLUDE_DIRS}" STREQUAL "$CACHE{${_prefix}_INCLUDE_DIRS}")
set(${_prefix}_INCLUDE_DIRS "${${_prefix}_INCLUDE_DIRS}" CACHE INTERNAL "")
endif()
endmacro()
endif()
endif()
# Do not use z_vcpkg_find_package_package_name beyond this point since it might have changed!
# Only variables using z_vcpkg_find_package_backup_id can used correctly below!
Expand Down