baibaichen commented on code in PR #12625:
URL: https://github.com/apache/gluten/pull/12625#discussion_r4165043084


##########
dev/vcpkg/toolchain.cmake:
##########
@@ -33,11 +33,30 @@ set(VCPKG_HOST_TRIPLET $ENV{VCPKG_TRIPLET})
 set(VCPKG_INSTALLED_DIR $ENV{VCPKG_MANIFEST_DIR}/vcpkg_installed)
 set(VCPKG_INSTALL_OPTIONS --no-print-usage)
 
-# Force read CMAKE_PREFIX_PATH from env
-set(CMAKE_PREFIX_PATH $ENV{CMAKE_PREFIX_PATH})
-
 include($ENV{VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake)
 
+if(NOT DEFINED CMAKE_FIND_PACKAGE_PREFER_CONFIG)
+  set(CMAKE_FIND_PACKAGE_PREFER_CONFIG ON)
+endif()
+set(CMAKE_FIND_PACKAGE_PREFER_CONFIG "${CMAKE_FIND_PACKAGE_PREFER_CONFIG}" 
CACHE BOOL
+    "Prefer package configuration files." FORCE)
+set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY CACHE STRING "Search for packages 
only in root paths." FORCE)
+set(CMAKE_FIND_USE_PACKAGE_REGISTRY OFF CACHE BOOL "Disable the user package 
registry." FORCE)

Review Comment:
   I could not reproduce host package injection with the current toolchain. 
Using the actual `dev/vcpkg/toolchain.cmake`, I placed a fake 
`PoisonConfig.cmake` under `/tmp/gluten-cmake-poison` and configured with 
`CMAKE_PREFIX_PATH=/tmp/gluten-cmake-poison`; `find_package(Poison CONFIG 
REQUIRED)` failed. As a control, setting `CMAKE_FIND_ROOT_PATH_MODE_PACKAGE` to 
`BOTH` immediately made the same inherited environment prefix resolve the 
package. The existing forced `CMAKE_FIND_ROOT_PATH_MODE_PACKAGE=ONLY` therefore 
already excludes this arbitrary host prefix, so disabling all CMake 
environment-path lookup would be redundant and broader than required.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to