build: fix vcpkg binary package list parsing
Fix parsing of package list from the server html, which was ignoring brotli because it was on the same line as another package. Use a different method to extract the links that does not rely on them being on separate lines. Also fix the errors from `vcpkg list` on new vcpkg clones. Signed-off-by: Rafael Kitover <rkitover@gmail.com>
This commit is contained in:
parent
92d9230e2c
commit
7dc95076e5
|
@ -145,7 +145,7 @@ function(vcpkg_is_installed vcpkg_exe pkg_name pkg_ver pkg_triplet powershell ou
|
|||
|
||||
string(REPLACE "-" "." pkg_ver ${pkg_ver})
|
||||
|
||||
if(NOT DEFINED VCPKG_INSTALLED)
|
||||
if(NOT DEFINED VCPKG_INSTALLED_COUNT)
|
||||
if(VCPKG_ROOT MATCHES "^C:/Program Files/Microsoft Visual Studio/")
|
||||
execute_process(
|
||||
COMMAND ${powershell}
|
||||
|
@ -157,6 +157,7 @@ function(vcpkg_is_installed vcpkg_exe pkg_name pkg_ver pkg_triplet powershell ou
|
|||
execute_process(
|
||||
COMMAND ${vcpkg_exe} list
|
||||
OUTPUT_VARIABLE vcpkg_list_text
|
||||
ERROR_QUIET
|
||||
)
|
||||
endif()
|
||||
|
||||
|
@ -242,13 +243,14 @@ function(get_binary_packages vcpkg_exe)
|
|||
endif()
|
||||
endforeach()
|
||||
|
||||
unset(binary_packages_html)
|
||||
unset(binary_packages)
|
||||
foreach(triplet ${triplets})
|
||||
file(
|
||||
STRINGS "${CMAKE_BINARY_DIR}/binary_package_list_${triplet}.html" links
|
||||
REGEX "<a href=\".*[.]zip"
|
||||
)
|
||||
string(APPEND binary_packages_html "${links}\n")
|
||||
file(READ "${CMAKE_BINARY_DIR}/binary_package_list_${triplet}.html" raw_html)
|
||||
string(REGEX MATCHALL "<a href=\"[^\"]+[.]zip\"" links ${raw_html})
|
||||
foreach(link ${links})
|
||||
string(REGEX REPLACE "<a href=\"([^\"]+[.]zip)\"" "\\1" pkg ${link})
|
||||
list(APPEND binary_packages ${pkg})
|
||||
endforeach()
|
||||
endforeach()
|
||||
|
||||
set(vcpkg_binpkg_dir ${CMAKE_BINARY_DIR}/vcpkg-binpkg)
|
||||
|
@ -270,13 +272,11 @@ function(get_binary_packages vcpkg_exe)
|
|||
set(powershell pwsh)
|
||||
endif()
|
||||
|
||||
unset(binary_packages)
|
||||
unset(to_install)
|
||||
foreach(pkg ${binary_packages_html})
|
||||
if(NOT pkg MATCHES "<a href=\"([^_]+)_([^_]+)_([^.]+)[.]zip\"")
|
||||
foreach(pkg ${binary_packages})
|
||||
if(NOT pkg MATCHES "([^_]+)_([^_]+)_([^.]+)[.]zip")
|
||||
continue()
|
||||
endif()
|
||||
set(pkg "${CMAKE_MATCH_1}_${CMAKE_MATCH_2}_${CMAKE_MATCH_3}.zip")
|
||||
set(pkg_name ${CMAKE_MATCH_1})
|
||||
set(pkg_version ${CMAKE_MATCH_2})
|
||||
set(pkg_triplet ${CMAKE_MATCH_3})
|
||||
|
|
Loading…
Reference in New Issue