-
Notifications
You must be signed in to change notification settings - Fork 6.4k
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.cmake] Setup CMAKE_PROGRAM_PATH for the host if possible #23322
Changes from 3 commits
cb4b356
f13a87a
5f0ada1
dc65e38
17737bc
24c8a5b
cbb2cfb
979b978
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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) | ||
|
||
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") | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
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
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I can confirm that changing |
||
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}") | ||
Neumann-A marked this conversation as resolved.
Show resolved
Hide resolved
|
||
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) | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@JackBoosY @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 effectIt seems like the best option is to place a call to
cmake_policy(SET CMP0127 NEW)
just before the call tocmake_dependent_option
. Does that seem like a reasonable fix? If so, I can prepare the change. Thanks!There was a problem hiding this comment.
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.