mirror of
https://github.com/microsoft/vcpkg.git
synced 2024-12-27 02:11:58 +08:00
[vcpkg.cmake] don't clobber cmake program path (#23755)
* more filtering of tool paths. * test it in CI * only use tools/* and tools/*/bin * debugging * test removal of tools/* if tools/*/bin is available * fix variable naming * cleanup * revert ports/qtdeclarative/portfile.cmake
This commit is contained in:
parent
d2fd9975f6
commit
16ebf7b9b8
@ -538,15 +538,24 @@ if(VCPKG_SETUP_CMAKE_PROGRAM_PATH)
|
||||
set(tools_base_path "${VCPKG_INSTALLED_DIR}/${VCPKG_HOST_TRIPLET}/tools")
|
||||
endif()
|
||||
list(APPEND CMAKE_PROGRAM_PATH "${tools_base_path}")
|
||||
file(GLOB_RECURSE Z_VCPKG_TOOLS_DIRS LIST_DIRECTORIES true "${tools_base_path}/*")
|
||||
file(GLOB_RECURSE Z_VCPKG_TOOLS_FILES LIST_DIRECTORIES false "${tools_base_path}/*")
|
||||
file(GLOB Z_VCPKG_TOOLS_DIRS LIST_DIRECTORIES true "${tools_base_path}/*")
|
||||
file(GLOB Z_VCPKG_TOOLS_FILES LIST_DIRECTORIES false "${tools_base_path}/*")
|
||||
file(GLOB Z_VCPKG_TOOLS_DIRS_BIN LIST_DIRECTORIES true "${tools_base_path}/*/bin")
|
||||
file(GLOB Z_VCPKG_TOOLS_FILES_BIN LIST_DIRECTORIES false "${tools_base_path}/*/bin")
|
||||
list(REMOVE_ITEM Z_VCPKG_TOOLS_DIRS ${Z_VCPKG_TOOLS_FILES} "") # need at least one item for REMOVE_ITEM if CMake <= 3.19
|
||||
list(FILTER Z_VCPKG_TOOLS_DIRS EXCLUDE REGEX "/debug/")
|
||||
list(REMOVE_ITEM Z_VCPKG_TOOLS_DIRS_BIN ${Z_VCPKG_TOOLS_FILES_BIN} "")
|
||||
string(REPLACE "/bin" "" Z_VCPKG_TOOLS_DIRS_TO_REMOVE "${Z_VCPKG_TOOLS_DIRS_BIN}")
|
||||
list(REMOVE_ITEM Z_VCPKG_TOOLS_DIRS ${Z_VCPKG_TOOLS_DIRS_TO_REMOVE} "")
|
||||
list(APPEND Z_VCPKG_TOOLS_DIRS ${Z_VCPKG_TOOLS_DIRS_BIN})
|
||||
foreach(Z_VCPKG_TOOLS_DIR IN LISTS Z_VCPKG_TOOLS_DIRS)
|
||||
list(APPEND CMAKE_PROGRAM_PATH "${Z_VCPKG_TOOLS_DIR}")
|
||||
endforeach()
|
||||
unset(Z_VCPKG_TOOLS_DIRS)
|
||||
unset(Z_VCPKG_TOOLS_DIR)
|
||||
unset(Z_VCPKG_TOOLS_DIRS)
|
||||
unset(Z_VCPKG_TOOLS_FILES)
|
||||
unset(Z_VCPKG_TOOLS_DIRS_BIN)
|
||||
unset(Z_VCPKG_TOOLS_FILES_BIN)
|
||||
unset(Z_VCPKG_TOOLS_DIRS_TO_REMOVE)
|
||||
unset(tools_base_path)
|
||||
endif()
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user