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

[vcpkg] Honor CMAKE_DISABLE_FIND_PACKAGE_*. Fixes #18631 #18961

Closed
Closed
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion scripts/buildsystems/vcpkg.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -739,7 +739,16 @@ macro("${VCPKG_OVERRIDE_FIND_PACKAGE_NAME}" z_vcpkg_find_package_package_name)
set(z_vcpkg_find_package_vcpkg_cmake_wrapper_path
"${_VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}/share/${z_vcpkg_find_package_lowercase_package_name}/vcpkg-cmake-wrapper.cmake")

if(EXISTS "${z_vcpkg_find_package_vcpkg_cmake_wrapper_path}")
if(CMAKE_DISABLE_FIND_PACKAGE_${z_vcpkg_find_package_package_name})
list(FIND z_vcpkg_find_package_ARGN "REQUIRED" z_vcpkg_required_idx)
if(z_vcpkg_required_idx STREQUAL "-1")
# Do nothing in the case of find_package disabled and not REQUIRED
# CMake 3.20 does not set ${z_vcpkg_find_package_package_name}_FOUND in this case
else()
# If REQUIRED, let CMake handle the error reporting
_find_package("${z_vcpkg_find_package_package_name}" ${z_vcpkg_find_package_ARGN})
endif()
elseif(EXISTS "${z_vcpkg_find_package_vcpkg_cmake_wrapper_path}")
list(APPEND z_vcpkg_find_package_backup_vars "ARGS")
if(DEFINED ARGS)
set(z_vcpkg_find_package_backup_ARGS "${ARGS}")
Expand Down
2 changes: 1 addition & 1 deletion scripts/ports.cmake
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# rebuild: 1
# rebuild: 2
cmake_minimum_required(VERSION 3.20)

set(SCRIPTS "${CMAKE_CURRENT_LIST_DIR}" CACHE PATH "Location to stored scripts")
Expand Down