Skip to content
Merged
Show file tree
Hide file tree
Changes from 5 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
2 changes: 1 addition & 1 deletion scripts/azure-pipelines/test-modified-ports.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ $parentHashes = @()
if (($BuildReason -eq 'PullRequest') -and -not $NoParentHashes)
{
# Prefetch tools for better output
& "./vcpkg$executableExtension" fetch 7zip
& "./vcpkg$executableExtension" fetch 7zip --debug
& "./vcpkg$executableExtension" fetch cmake
& "./vcpkg$executableExtension" fetch ninja
& "./vcpkg$executableExtension" fetch git
Expand Down
27 changes: 21 additions & 6 deletions scripts/buildsystems/vcpkg.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -517,13 +517,28 @@ if(VCPKG_MANIFEST_MODE AND VCPKG_MANIFEST_INSTALL AND NOT Z_VCPKG_CMAKE_IN_TRY_C
endif()
endif()

list(APPEND CMAKE_PROGRAM_PATH "${_VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}/tools")
file(GLOB Z_VCPKG_TOOLS_DIRS "${_VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}/tools/*")
foreach(Z_VCPKG_TOOLS_DIR IN LISTS Z_VCPKG_TOOLS_DIRS)
if(IS_DIRECTORY "${Z_VCPKG_TOOLS_DIR}")
list(APPEND CMAKE_PROGRAM_PATH "${Z_VCPKG_TOOLS_DIR}")
option(VCPKG_SETUP_CMAKE_PROGRAM_PATH "Enable the setup of CMAKE_PROGRAM_PATH to vcpkg paths" ON)
cmake_dependent_option(VCPKG_USE_HOST_TOOLS "Setup CMAKE_PROGRAM_PATH to use host tools" ON "NOT VCPKG_HOST_TRIPLET STREQUAL \"\"" OFF)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

CMake Warning (dev) at F:/vcpkg/downloads/tools/cmake-3.22.2-windows/cmake-3.22.2-windows-i386/share/cmake-3.22/Modules/CMakeDependentOption.cmake:84 (message):
  Policy CMP0127 is not set: cmake_dependent_option() supports full Condition
  Syntax.  Run "cmake --help-policy CMP0127" for policy details.  Use the
  cmake_policy command to set the policy and suppress this warning.
Call Stack (most recent call first):
  F:/vcpkg/scripts/buildsystems/vcpkg.cmake:521 (cmake_dependent_option)
  F:/vcpkg/buildtrees/libwebsockets/x64-windows-rel/CMakeFiles/3.22.2/CMakeSystem.cmake:6 (include)
  F:/vcpkg/buildtrees/libwebsockets/x64-windows-rel/CMakeFiles/CMakeTmp/CMakeLists.txt:5 (project)
This warning is for project developers.  Use -Wno-dev to suppress it.

@tusharb86 Tushar Bhatnagar (tusharb86) Jul 22, 2022

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Jack·Boos·Yu (@JackBoosY) Alexander Neumann (@Neumann-A) - I'm seeing the same warning about CMP0127 in our project. I'm using CMake version 3.23.1. Because vcpkg.cmake is wrapped in a cmake_policy push/pop, I can't set a policy outside of the file as it doesn't have any effect ☹️

It seems like the best option is to place a call to cmake_policy(SET CMP0127 NEW) just before the call to cmake_dependent_option. Does that seem like a reasonable fix? If so, I can prepare the change. Thanks!

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've created an issue to track this here #25985.


if(VCPKG_SETUP_CMAKE_PROGRAM_PATH)
set(tools_base_path "${VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}/tools")
if(VCPKG_USE_HOST_TOOLS)
set(tools_base_path "${VCPKG_INSTALLED_DIR}/${VCPKG_HOST_TRIPLET}/tools")

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

VCPKG_HOST_TRIPLET maybe empty here.
See #23395.

endif()
endforeach()
list(APPEND CMAKE_PROGRAM_PATH "${tools_base_path}")
file(GLOB_RECURSE Z_VCPKG_TOOLS_DIRS "${tools_base_path}/*")
file(GLOB_RECURSE Z_VCPKG_TOOLS_FILES LIST_DIRECTORIES false "${tools_base_path}/*")
list(REMOVE_ITEM Z_VCPKG_TOOLS_DIRS ${Z_VCPKG_TOOLS_FILES})
Comment on lines +529 to +531

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can confirm that changing GLOB_RECURSE to GLOB will fix the problem of Z_VCPKG_TOOLS_DIRS being empty when the base path has folders. Is it a cmake bug?

list(FILTER Z_VCPKG_TOOLS_DIRS EXCLUDE REGEX "/debug/")
foreach(Z_VCPKG_TOOLS_DIR IN LISTS Z_VCPKG_TOOLS_DIRS)
if(IS_DIRECTORY "${Z_VCPKG_TOOLS_DIR}")
Comment thread
Neumann-A marked this conversation as resolved.
Outdated
list(APPEND CMAKE_PROGRAM_PATH "${Z_VCPKG_TOOLS_DIR}")
endif()
endforeach()
unset(Z_VCPKG_TOOLS_DIRS)
unset(Z_VCPKG_TOOLS_DIR)
unset(tools_base_path)
endif()

cmake_policy(POP)

Expand Down