[vcpkg/scripts/make] add compiler tools to PATH (#17085)

* [vcpkg/scripts/make] add compiler tools to PATH

* use find_program to check if tools are already in PATH
This commit is contained in:
huangqinjin 2021-04-08 03:41:56 +08:00 committed by GitHub
parent b3e8d4dc69
commit 64efdb4658
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -329,13 +329,20 @@ function(vcpkg_configure_make)
endmacro() endmacro()
set(CONFIGURE_ENV "V=1") set(CONFIGURE_ENV "V=1")
# Remove full filepaths due to spaces (compiler needs to be on path) # Remove full filepaths due to spaces and prepend filepaths to PATH (cross-compiling tools are unlikely on path by default)
set(progs VCPKG_DETECTED_CMAKE_C_COMPILER VCPKG_DETECTED_CMAKE_CXX_COMPILER VCPKG_DETECTED_CMAKE_AR set(progs VCPKG_DETECTED_CMAKE_C_COMPILER VCPKG_DETECTED_CMAKE_CXX_COMPILER VCPKG_DETECTED_CMAKE_AR
VCPKG_DETECTED_CMAKE_LINKER VCPKG_DETECTED_CMAKE_RANLIB VCPKG_DETECTED_CMAKE_OBJDUMP VCPKG_DETECTED_CMAKE_LINKER VCPKG_DETECTED_CMAKE_RANLIB VCPKG_DETECTED_CMAKE_OBJDUMP
VCPKG_DETECTED_CMAKE_STRIP VCPKG_DETECTED_CMAKE_NM VCPKG_DETECTED_CMAKE_DLLTOOL VCPKG_DETECTED_CMAKE_RC_COMPILER) VCPKG_DETECTED_CMAKE_STRIP VCPKG_DETECTED_CMAKE_NM VCPKG_DETECTED_CMAKE_DLLTOOL VCPKG_DETECTED_CMAKE_RC_COMPILER)
foreach(prog IN LISTS progs) foreach(prog IN LISTS progs)
if(${prog}) if(${prog})
set(path "${${prog}}")
unset(prog_found CACHE)
get_filename_component(${prog} "${${prog}}" NAME) get_filename_component(${prog} "${${prog}}" NAME)
find_program(prog_found ${${prog}} PATHS ENV PATH NO_DEFAULT_PATH)
if(NOT path STREQUAL prog_found)
get_filename_component(path "${path}" DIRECTORY)
vcpkg_add_to_path(PREPEND ${path})
endif()
endif() endif()
endforeach() endforeach()
if (_csc_AUTOCONFIG OR _csc_USE_WRAPPERS) # without autotools we assume a custom configure script which correctly handles cl and lib. Otherwise the port needs to set CC|CXX|AR and probably CPP if (_csc_AUTOCONFIG OR _csc_USE_WRAPPERS) # without autotools we assume a custom configure script which correctly handles cl and lib. Otherwise the port needs to set CC|CXX|AR and probably CPP