diff --git a/cmake/Set-Toolchain-vcpkg.cmake b/cmake/Set-Toolchain-vcpkg.cmake index 3f259405..8dacc0cb 100644 --- a/cmake/Set-Toolchain-vcpkg.cmake +++ b/cmake/Set-Toolchain-vcpkg.cmake @@ -135,6 +135,8 @@ endfunction() function(vcpkg_is_installed vcpkg_exe pkg_name pkg_version outvar) set(${outvar} FALSE PARENT_SCOPE) + string(REGEX REPLACE "-r([0-9]+)\$" ".\\1" pkg_version ${pkg_version}) + if(NOT DEFINED VCPKG_INSTALLED) execute_process( COMMAND ${vcpkg_exe} list @@ -150,14 +152,16 @@ function(vcpkg_is_installed vcpkg_exe pkg_name pkg_version outvar) endif() set(inst_pkg_name ${CMAKE_MATCH_1}) set(inst_pkg_version ${CMAKE_MATCH_2}) - + + string(REGEX REPLACE "#([0-9]+)\$" ".\\1" inst_pkg_version ${inst_pkg_version}) + list(APPEND VCPKG_INSTALLED ${inst_pkg_name} ${inst_pkg_version}) math(EXPR VCPKG_INSTALLED_COUNT "${VCPKG_INSTALLED_COUNT} + 1") endforeach() set(VCPKG_INSTALLED ${VCPKG_INSTALLED} PARENT_SCOPE) set(VCPKG_INSTALLED_COUNT ${VCPKG_INSTALLED_COUNT} PARENT_SCOPE) endif() - + if(NOT VCPKG_INSTALLED_COUNT GREATER 0) return() endif() @@ -168,7 +172,7 @@ function(vcpkg_is_installed vcpkg_exe pkg_name pkg_version outvar) math(EXPR idx_ver "${idx} + 1") list(GET VCPKG_INSTALLED ${idx} inst_pkg_name) list(GET VCPKG_INSTALLED ${idx_ver} inst_pkg_ver) - + if(inst_pkg_name STREQUAL pkg_name AND (NOT inst_pkg_ver VERSION_LESS pkg_version)) set(${outvar} TRUE PARENT_SCOPE) return() @@ -178,7 +182,7 @@ endfunction() function(get_binary_packages vcpkg_exe) set(binary_packages_installed FALSE PARENT_SCOPE) - + file( DOWNLOAD "https://nightly.vba-m.com/vcpkg/${VCPKG_TARGET_TRIPLET}/" ${CMAKE_BINARY_DIR}/binary_package_list.html STATUS pkg_list_status @@ -190,7 +194,7 @@ function(get_binary_packages vcpkg_exe) message(STATUS "Failed to download vcpkg binary package list: ${pkg_list_status} - ${pkg_list_error}") return() endif() - + file( STRINGS ${CMAKE_BINARY_DIR}/binary_package_list.html binary_packages_html REGEX "