aboutsummaryrefslogtreecommitdiff
path: root/scripts/cmake
diff options
context:
space:
mode:
authorBarath Kannan <barathsotd@gmail.com>2017-11-06 00:33:04 +1100
committerBarath Kannan <barathsotd@gmail.com>2017-11-06 00:33:04 +1100
commitb959f70a9969551a132d691fbd12046d5ea0702e (patch)
treed15d129bd480b1ba173322a0e50140ccf1ff487a /scripts/cmake
parent3a5b383bbec74dbaf0f1056e1a5d315e43d79375 (diff)
parent330b8d8bab6a3d07165bf7c05fea09a8e0d56348 (diff)
downloadvcpkg-b959f70a9969551a132d691fbd12046d5ea0702e.tar.gz
vcpkg-b959f70a9969551a132d691fbd12046d5ea0702e.zip
merge from master
Diffstat (limited to 'scripts/cmake')
-rw-r--r--scripts/cmake/vcpkg_acquire_depot_tools.cmake48
-rw-r--r--scripts/cmake/vcpkg_acquire_msys.cmake10
-rw-r--r--scripts/cmake/vcpkg_common_functions.cmake2
-rw-r--r--scripts/cmake/vcpkg_download_distfile.cmake13
-rw-r--r--scripts/cmake/vcpkg_find_acquire_program.cmake22
-rw-r--r--scripts/cmake/vcpkg_fixup_cmake_targets.cmake20
-rw-r--r--scripts/cmake/vcpkg_from_bitbucket.cmake38
-rw-r--r--scripts/cmake/vcpkg_from_github.cmake34
-rw-r--r--scripts/cmake/vcpkg_get_windows_sdk.cmake4
9 files changed, 77 insertions, 114 deletions
diff --git a/scripts/cmake/vcpkg_acquire_depot_tools.cmake b/scripts/cmake/vcpkg_acquire_depot_tools.cmake
deleted file mode 100644
index 009ba40f1..000000000
--- a/scripts/cmake/vcpkg_acquire_depot_tools.cmake
+++ /dev/null
@@ -1,48 +0,0 @@
-function(vcpkg_acquire_depot_tools PATH_TO_ROOT_OUT)
- set(TOOLPATH ${DOWNLOADS}/tools/depot_tools)
- set(URL "https://storage.googleapis.com/chrome-infra/depot_tools.zip")
- set(ARCHIVE "depot_tools.zip")
- set(STAMP "initialized-depot-tools.stamp")
- set(downloaded_file_path ${DOWNLOADS}/${ARCHIVE})
-
- if(NOT EXISTS "${TOOLPATH}/${STAMP}")
-
- message(STATUS "Acquiring Depot Tools...")
-
- if(EXISTS ${downloaded_file_path})
- message(STATUS "Using cached ${downloaded_file_path}")
- else()
- if(_VCPKG_NO_DOWNLOADS)
- message(FATAL_ERROR "Downloads are disabled, but '${downloaded_file_path}' does not exist.")
- endif()
- file(DOWNLOAD ${URL} ${downloaded_file_path} STATUS download_status)
- list(GET download_status 0 status_code)
- if (NOT "${status_code}" STREQUAL "0")
- message(STATUS "Downloading ${URL}... Failed. Status: ${download_status}")
- file(REMOVE ${downloaded_file_path})
- set(download_success 0)
- else()
- message(STATUS "Downloading ${URL}... OK")
- set(download_success 1)
- endif()
-
- if (NOT download_success)
- message(FATAL_ERROR
- "\n"
- " Failed to download file.\n"
- " Add mirrors or submit an issue at https://github.com/Microsoft/vcpkg/issues\n")
- endif()
- endif()
-
-
- file(REMOVE_RECURSE ${TOOLPATH})
- file(MAKE_DIRECTORY ${TOOLPATH})
- execute_process(
- COMMAND ${CMAKE_COMMAND} -E tar xzf ${DOWNLOADS}/${ARCHIVE}
- WORKING_DIRECTORY ${TOOLPATH}
- )
- file(WRITE "${TOOLPATH}/${STAMP}" "0")
- message(STATUS "Acquiring Depot Tools... OK")
- endif()
- set(${PATH_TO_ROOT_OUT} ${TOOLPATH} PARENT_SCOPE)
-endfunction()
diff --git a/scripts/cmake/vcpkg_acquire_msys.cmake b/scripts/cmake/vcpkg_acquire_msys.cmake
index 830022906..80a30bf2b 100644
--- a/scripts/cmake/vcpkg_acquire_msys.cmake
+++ b/scripts/cmake/vcpkg_acquire_msys.cmake
@@ -70,14 +70,18 @@ function(vcpkg_acquire_msys PATH_TO_ROOT_OUT)
set(PATH_TO_ROOT ${TOOLPATH}/${TOOLSUBPATH})
if(NOT EXISTS "${TOOLPATH}/${STAMP}")
+
message(STATUS "Acquiring MSYS2...")
- file(DOWNLOAD ${URL} ${DOWNLOADS}/${ARCHIVE}
- EXPECTED_HASH SHA512=${HASH}
+ vcpkg_download_distfile(ARCHIVE_PATH
+ URLS ${URL}
+ FILENAME ${ARCHIVE}
+ SHA512 ${HASH}
)
+
file(REMOVE_RECURSE ${TOOLPATH}/${TOOLSUBPATH})
file(MAKE_DIRECTORY ${TOOLPATH})
execute_process(
- COMMAND ${CMAKE_COMMAND} -E tar xzf ${DOWNLOADS}/${ARCHIVE}
+ COMMAND ${CMAKE_COMMAND} -E tar xzf ${ARCHIVE_PATH}
WORKING_DIRECTORY ${TOOLPATH}
)
execute_process(
diff --git a/scripts/cmake/vcpkg_common_functions.cmake b/scripts/cmake/vcpkg_common_functions.cmake
index 40111542d..258b8f64a 100644
--- a/scripts/cmake/vcpkg_common_functions.cmake
+++ b/scripts/cmake/vcpkg_common_functions.cmake
@@ -25,4 +25,4 @@ include(vcpkg_copy_tool_dependencies)
include(vcpkg_get_program_files_32_bit)
include(vcpkg_get_program_files_platform_bitness)
include(vcpkg_get_windows_sdk)
-include(vcpkg_replace_string)
+include(vcpkg_replace_string) \ No newline at end of file
diff --git a/scripts/cmake/vcpkg_download_distfile.cmake b/scripts/cmake/vcpkg_download_distfile.cmake
index b8acfc823..b22d82a16 100644
--- a/scripts/cmake/vcpkg_download_distfile.cmake
+++ b/scripts/cmake/vcpkg_download_distfile.cmake
@@ -38,9 +38,18 @@ function(vcpkg_download_distfile VAR)
set(oneValueArgs FILENAME SHA512)
set(multipleValuesArgs URLS)
cmake_parse_arguments(vcpkg_download_distfile "" "${oneValueArgs}" "${multipleValuesArgs}" ${ARGN})
+
set(downloaded_file_path ${DOWNLOADS}/${vcpkg_download_distfile_FILENAME})
+ set(download_file_path_part "${DOWNLOADS}/temp/${vcpkg_download_distfile_FILENAME}")
+
+ file(REMOVE_RECURSE "${DOWNLOADS}/temp")
+ file(MAKE_DIRECTORY "${DOWNLOADS}/temp")
function(test_hash FILE_KIND CUSTOM_ERROR_ADVICE)
+ if (_VCPKG_INTERNAL_NO_HASH_CHECK)
+ return()
+ endif()
+
message(STATUS "Testing integrity of ${FILE_KIND}...")
file(SHA512 ${downloaded_file_path} FILE_HASH)
if(NOT "${FILE_HASH}" STREQUAL "${vcpkg_download_distfile_SHA512}")
@@ -65,13 +74,13 @@ function(vcpkg_download_distfile VAR)
# Tries to download the file.
foreach(url IN LISTS vcpkg_download_distfile_URLS)
message(STATUS "Downloading ${url}...")
- file(DOWNLOAD ${url} ${downloaded_file_path} STATUS download_status)
+ file(DOWNLOAD ${url} "${download_file_path_part}" STATUS download_status)
list(GET download_status 0 status_code)
if (NOT "${status_code}" STREQUAL "0")
message(STATUS "Downloading ${url}... Failed. Status: ${download_status}")
- file(REMOVE ${downloaded_file_path})
set(download_success 0)
else()
+ file(RENAME ${download_file_path_part} ${downloaded_file_path})
message(STATUS "Downloading ${url}... OK")
set(download_success 1)
break()
diff --git a/scripts/cmake/vcpkg_find_acquire_program.cmake b/scripts/cmake/vcpkg_find_acquire_program.cmake
index b81675c13..e6a37e328 100644
--- a/scripts/cmake/vcpkg_find_acquire_program.cmake
+++ b/scripts/cmake/vcpkg_find_acquire_program.cmake
@@ -110,10 +110,10 @@ function(vcpkg_find_acquire_program VAR)
set(PROGNAME meson)
set(REQUIRED_INTERPRETER PYTHON3)
set(SCRIPTNAME meson.py)
- set(PATHS ${DOWNLOADS}/tools/meson/meson-0.40.1)
- set(URL "https://github.com/mesonbuild/meson/archive/0.40.1.zip")
- set(ARCHIVE "meson-0.40.1.zip")
- set(HASH 4c1d07f32d527859f762c34de74d31d569573fc833335ab9652ed38d1f9e64b49869e826527c28a6a07cb8e594fd5c647b34aa95e626236a2707f75df0a2d435)
+ set(PATHS ${DOWNLOADS}/tools/meson/meson-0.43.0)
+ set(URL "https://github.com/mesonbuild/meson/archive/0.43.0.zip")
+ set(ARCHIVE "meson-0.43.0.zip")
+ set(HASH dde4de72eff37046731224f32aa5f4618d45bdf148cec2d1af6e25e7522ebc2b04aedc9eceed483dfa93823a0ea7ea472d0c0c9380061bf3ee2f16b87dd1425e)
elseif(VAR MATCHES "FLEX")
set(PROGNAME win_flex)
set(PATHS ${DOWNLOADS}/tools/win_flex)
@@ -164,18 +164,20 @@ function(vcpkg_find_acquire_program VAR)
do_find()
if("${${VAR}}" MATCHES "-NOTFOUND")
- file(DOWNLOAD ${URL} ${DOWNLOADS}/${ARCHIVE}
- EXPECTED_HASH SHA512=${HASH}
- SHOW_PROGRESS
+ vcpkg_download_distfile(ARCHIVE_PATH
+ URLS ${URL}
+ SHA512 ${HASH}
+ FILENAME ${ARCHIVE}
)
+
file(MAKE_DIRECTORY ${DOWNLOADS}/tools/${PROGNAME}/${SUBDIR})
if(DEFINED NOEXTRACT)
- file(COPY ${DOWNLOADS}/${ARCHIVE} DESTINATION ${DOWNLOADS}/tools/${PROGNAME}/${SUBDIR})
+ file(COPY ${ARCHIVE_PATH} DESTINATION ${DOWNLOADS}/tools/${PROGNAME}/${SUBDIR})
else()
get_filename_component(ARCHIVE_EXTENSION ${ARCHIVE} EXT)
string(TOLOWER "${ARCHIVE_EXTENSION}" ARCHIVE_EXTENSION)
if(ARCHIVE_EXTENSION STREQUAL ".msi")
- file(TO_NATIVE_PATH "${DOWNLOADS}/${ARCHIVE}" ARCHIVE_NATIVE_PATH)
+ file(TO_NATIVE_PATH "${ARCHIVE_PATH}" ARCHIVE_NATIVE_PATH)
file(TO_NATIVE_PATH "${DOWNLOADS}/tools/${PROGNAME}/${SUBDIR}" DESTINATION_NATIVE_PATH)
execute_process(
COMMAND msiexec /a ${ARCHIVE_NATIVE_PATH} /qn TARGETDIR=${DESTINATION_NATIVE_PATH}
@@ -183,7 +185,7 @@ function(vcpkg_find_acquire_program VAR)
)
else()
execute_process(
- COMMAND ${CMAKE_COMMAND} -E tar xzf ${DOWNLOADS}/${ARCHIVE}
+ COMMAND ${CMAKE_COMMAND} -E tar xzf ${ARCHIVE_PATH}
WORKING_DIRECTORY ${DOWNLOADS}/tools/${PROGNAME}/${SUBDIR}
)
endif()
diff --git a/scripts/cmake/vcpkg_fixup_cmake_targets.cmake b/scripts/cmake/vcpkg_fixup_cmake_targets.cmake
index eaf3bb966..22c2245c8 100644
--- a/scripts/cmake/vcpkg_fixup_cmake_targets.cmake
+++ b/scripts/cmake/vcpkg_fixup_cmake_targets.cmake
@@ -23,7 +23,7 @@ function(vcpkg_fixup_cmake_targets)
set(DEBUG_SHARE ${CURRENT_PACKAGES_DIR}/debug/share/${PORT})
set(RELEASE_SHARE ${CURRENT_PACKAGES_DIR}/share/${PORT})
- if(_vfct_CONFIG_PATH)
+ if(_vfct_CONFIG_PATH AND NOT RELEASE_SHARE STREQUAL "${CURRENT_PACKAGES_DIR}/${_vfct_CONFIG_PATH}")
set(DEBUG_CONFIG ${CURRENT_PACKAGES_DIR}/debug/${_vfct_CONFIG_PATH})
set(RELEASE_CONFIG ${CURRENT_PACKAGES_DIR}/${_vfct_CONFIG_PATH})
@@ -31,10 +31,14 @@ function(vcpkg_fixup_cmake_targets)
message(FATAL_ERROR "'${DEBUG_CONFIG}' does not exist.")
endif()
- file(MAKE_DIRECTORY ${CURRENT_PACKAGES_DIR}/debug/share)
- file(RENAME ${DEBUG_CONFIG} ${DEBUG_SHARE})
- file(MAKE_DIRECTORY ${CURRENT_PACKAGES_DIR}/share)
- file(RENAME ${RELEASE_CONFIG} ${RELEASE_SHARE})
+ file(MAKE_DIRECTORY ${DEBUG_SHARE})
+ file(GLOB FILES ${DEBUG_CONFIG}/*)
+ file(COPY ${FILES} DESTINATION ${DEBUG_SHARE})
+ file(REMOVE_RECURSE ${DEBUG_CONFIG})
+
+ file(GLOB FILES ${RELEASE_CONFIG}/*)
+ file(COPY ${FILES} DESTINATION ${RELEASE_SHARE})
+ file(REMOVE_RECURSE ${RELEASE_CONFIG})
get_filename_component(DEBUG_CONFIG_DIR_NAME ${DEBUG_CONFIG} NAME)
string(TOLOWER "${DEBUG_CONFIG_DIR_NAME}" DEBUG_CONFIG_DIR_NAME)
@@ -83,6 +87,7 @@ function(vcpkg_fixup_cmake_targets)
)
foreach(RELEASE_TARGET ${RELEASE_TARGETS})
file(READ ${RELEASE_TARGET} _contents)
+ string(REPLACE "${CURRENT_INSTALLED_DIR}" "\${_IMPORT_PREFIX}" _contents "${_contents}")
string(REGEX REPLACE "\\\${_IMPORT_PREFIX}/bin/([^ \"]+\\.exe)" "\${_IMPORT_PREFIX}/tools/${PORT}/\\1" _contents "${_contents}")
file(WRITE ${RELEASE_TARGET} "${_contents}")
endforeach()
@@ -95,6 +100,7 @@ function(vcpkg_fixup_cmake_targets)
get_filename_component(DEBUG_TARGET_NAME ${DEBUG_TARGET} NAME)
file(READ ${DEBUG_TARGET} _contents)
+ string(REPLACE "${CURRENT_INSTALLED_DIR}" "\${_IMPORT_PREFIX}" _contents "${_contents}")
string(REGEX REPLACE "\\\${_IMPORT_PREFIX}/bin/([^ \"]+\\.exe)" "\${_IMPORT_PREFIX}/tools/${PORT}/\\1" _contents "${_contents}")
string(REPLACE "\${_IMPORT_PREFIX}/lib" "\${_IMPORT_PREFIX}/debug/lib" _contents "${_contents}")
string(REPLACE "\${_IMPORT_PREFIX}/bin" "\${_IMPORT_PREFIX}/debug/bin" _contents "${_contents}")
@@ -110,6 +116,10 @@ function(vcpkg_fixup_cmake_targets)
"get_filename_component\\(_IMPORT_PREFIX \"\\\${CMAKE_CURRENT_LIST_FILE}\" PATH\\)(\nget_filename_component\\(_IMPORT_PREFIX \"\\\${_IMPORT_PREFIX}\" PATH\\))*"
"get_filename_component(_IMPORT_PREFIX \"\${CMAKE_CURRENT_LIST_FILE}\" PATH)\nget_filename_component(_IMPORT_PREFIX \"\${_IMPORT_PREFIX}\" PATH)\nget_filename_component(_IMPORT_PREFIX \"\${_IMPORT_PREFIX}\" PATH)"
_contents "${_contents}")
+ string(REPLACE "${CURRENT_INSTALLED_DIR}" "_INVALID_ROOT_" _contents "${_contents}")
+ string(REGEX REPLACE ";_INVALID_ROOT_/[^\";]*" "" _contents "${_contents}")
+ string(REGEX REPLACE "_INVALID_ROOT_/[^\";]*;" "" _contents "${_contents}")
+ string(REGEX REPLACE "\"_INVALID_ROOT_/[^\";]*\"" "\"\"" _contents "${_contents}")
file(WRITE ${MAIN_TARGET} "${_contents}")
endforeach()
diff --git a/scripts/cmake/vcpkg_from_bitbucket.cmake b/scripts/cmake/vcpkg_from_bitbucket.cmake
index 227de5141..26600f013 100644
--- a/scripts/cmake/vcpkg_from_bitbucket.cmake
+++ b/scripts/cmake/vcpkg_from_bitbucket.cmake
@@ -92,13 +92,13 @@ function(vcpkg_from_bitbucket)
message(STATUS "Package does not specify HEAD_REF. Falling back to non-HEAD version.")
set(VCPKG_USE_HEAD_VERSION OFF)
endif()
-
+
# Handle --no-head scenarios
if(NOT VCPKG_USE_HEAD_VERSION)
if(NOT _vdud_REF)
message(FATAL_ERROR "Package does not specify REF. It must built using --head.")
endif()
-
+
set(URL "https://bitbucket.com/${ORG_NAME}/${REPO_NAME}/get/${_vdud_REF}.tar.gz")
set(downloaded_file_path "${DOWNLOADS}/${ORG_NAME}-${REPO_NAME}-${_vdud_REF}.tar.gz")
@@ -117,7 +117,7 @@ function(vcpkg_from_bitbucket)
else()
set(_version ${_vdud_REF})
endif()
-
+
vcpkg_download_distfile(ARCHIVE
URLS "https://bitbucket.com/${ORG_NAME}/${REPO_NAME}/get/${_vdud_REF}.tar.gz"
SHA512 "${_vdud_SHA512}"
@@ -150,39 +150,31 @@ function(vcpkg_from_bitbucket)
endif()
# Try to download the file and version information from bitbucket.
- message(STATUS "Downloading ${URL}...")
- file(DOWNLOAD "https://api.bitbucket.com/2.0/repositories/${ORG_NAME}/${REPO_NAME}/refs/branches/${_vdud_HEAD_REF}"
- ${downloaded_file_path}.version
- STATUS download_status
+ set(_VCPKG_INTERNAL_NO_HASH_CHECK "TRUE")
+ vcpkg_download_distfile(ARCHIVE_VERSION
+ URLS "https://api.bitbucket.com/2.0/repositories/${ORG_NAME}/${REPO_NAME}/refs/branches/${_vdud_HEAD_REF}"
+ FILENAME ${downloaded_file_name}.version
)
- list(GET download_status 0 status_code)
- if (NOT "${status_code}" STREQUAL "0")
- file(REMOVE ${downloaded_file_path}.version)
- message(FATAL_ERROR "Downloading version info for ${URL}... Failed. Status: ${download_status}")
- endif()
- file(DOWNLOAD ${URL} ${downloaded_file_path} STATUS download_status)
- list(GET download_status 0 status_code)
- if (NOT "${status_code}" STREQUAL "0")
- file(REMOVE ${downloaded_file_path})
- message(FATAL_ERROR "Downloading ${URL}... Failed. Status: ${download_status}")
- else()
- message(STATUS "Downloading ${URL}... OK")
- endif()
+ vcpkg_download_distfile(ARCHIVE
+ URLS ${URL}
+ FILENAME ${downloaded_file_name}
+ )
+ set(_VCPKG_INTERNAL_NO_HASH_CHECK "FALSE")
endif()
vcpkg_extract_source_archive_ex(
- ARCHIVE "${downloaded_file_path}"
+ ARCHIVE "${ARCHIVE}"
WORKING_DIRECTORY "${CURRENT_BUILDTREES_DIR}/src/head"
)
# Parse the github refs response with regex.
# TODO: use some JSON swiss-army-knife utility instead.
- file(READ "${downloaded_file_path}.version" _contents)
+ file(READ "${ARCHIVE_VERSION}" _contents)
string(REGEX MATCH "\"hash\": \"[a-f0-9]+\"" x "${_contents}")
string(REGEX REPLACE "\"hash\": \"([a-f0-9]+)\"" "\\1" _version ${x})
string(SUBSTRING ${_version} 0 12 _vdud_HEAD_REF) # Get the 12 first numbers from commit hash
-
+
# exports VCPKG_HEAD_VERSION to the caller. This will get picked up by ports.cmake after the build.
set(VCPKG_HEAD_VERSION ${_version} PARENT_SCOPE)
diff --git a/scripts/cmake/vcpkg_from_github.cmake b/scripts/cmake/vcpkg_from_github.cmake
index 645690353..1ede43fd8 100644
--- a/scripts/cmake/vcpkg_from_github.cmake
+++ b/scripts/cmake/vcpkg_from_github.cmake
@@ -80,6 +80,7 @@ function(vcpkg_from_github)
else()
# Sometimes GitHub strips a leading 'v' off the REF.
string(REGEX REPLACE "^v" "" REF ${BASEREF})
+ string(REPLACE "/" "-" REF ${REF})
set(SOURCE_PATH "${BASE}/${REPO_NAME}-${REF}")
if(EXISTS ${SOURCE_PATH})
set(${_vdud_OUT_SOURCE_PATH} "${SOURCE_PATH}" PARENT_SCOPE)
@@ -112,7 +113,8 @@ function(vcpkg_from_github)
# The following is for --head scenarios
set(URL "https://github.com/${ORG_NAME}/${REPO_NAME}/archive/${_vdud_HEAD_REF}.tar.gz")
- set(downloaded_file_path "${DOWNLOADS}/${ORG_NAME}-${REPO_NAME}-${_vdud_HEAD_REF}.tar.gz")
+ set(downloaded_file_name "${ORG_NAME}-${REPO_NAME}-${_vdud_HEAD_REF}.tar.gz")
+ set(downloaded_file_path "${DOWNLOADS}/${downloaded_file_name}")
if(_VCPKG_NO_DOWNLOADS)
if(NOT EXISTS ${downloaded_file_path} OR NOT EXISTS ${downloaded_file_path}.version)
@@ -132,35 +134,27 @@ function(vcpkg_from_github)
endif()
# Try to download the file and version information from github.
- message(STATUS "Downloading ${URL}...")
- file(DOWNLOAD "https://api.github.com/repos/${ORG_NAME}/${REPO_NAME}/git/refs/heads/${_vdud_HEAD_REF}"
- ${downloaded_file_path}.version
- STATUS download_status
+ set(_VCPKG_INTERNAL_NO_HASH_CHECK "TRUE")
+ vcpkg_download_distfile(ARCHIVE_VERSION
+ URLS "https://api.github.com/repos/${ORG_NAME}/${REPO_NAME}/git/refs/heads/${_vdud_HEAD_REF}"
+ FILENAME ${downloaded_file_name}.version
)
- list(GET download_status 0 status_code)
- if (NOT "${status_code}" STREQUAL "0")
- file(REMOVE ${downloaded_file_path}.version)
- message(FATAL_ERROR "Downloading version info for ${URL}... Failed. Status: ${download_status}")
- endif()
- file(DOWNLOAD ${URL} ${downloaded_file_path} STATUS download_status)
- list(GET download_status 0 status_code)
- if (NOT "${status_code}" STREQUAL "0")
- file(REMOVE ${downloaded_file_path})
- message(FATAL_ERROR "Downloading ${URL}... Failed. Status: ${download_status}")
- else()
- message(STATUS "Downloading ${URL}... OK")
- endif()
+ vcpkg_download_distfile(ARCHIVE
+ URLS ${URL}
+ FILENAME ${downloaded_file_name}
+ )
+ set(_VCPKG_INTERNAL_NO_HASH_CHECK "FALSE")
endif()
vcpkg_extract_source_archive_ex(
- ARCHIVE "${downloaded_file_path}"
+ ARCHIVE "${ARCHIVE}"
WORKING_DIRECTORY "${CURRENT_BUILDTREES_DIR}/src/head"
)
# Parse the github refs response with regex.
# TODO: use some JSON swiss-army-knife utility instead.
- file(READ "${downloaded_file_path}.version" _contents)
+ file(READ "${ARCHIVE_VERSION}" _contents)
string(REGEX MATCH "\"sha\": \"[a-f0-9]+\"" x "${_contents}")
string(REGEX REPLACE "\"sha\": \"([a-f0-9]+)\"" "\\1" _version ${x})
diff --git a/scripts/cmake/vcpkg_get_windows_sdk.cmake b/scripts/cmake/vcpkg_get_windows_sdk.cmake
index 64d8838e7..a8aad64a9 100644
--- a/scripts/cmake/vcpkg_get_windows_sdk.cmake
+++ b/scripts/cmake/vcpkg_get_windows_sdk.cmake
@@ -10,7 +10,7 @@ function(vcpkg_get_windows_sdk ret)
message(FATAL_ERROR "Could not find Windows SDK")
endif()
- # Remove trailing newline
- string(REGEX REPLACE "\n$" "" WINDOWS_SDK "${WINDOWS_SDK}")
+ # Remove trailing newline and non-numeric characters
+ string(REGEX REPLACE "[^0-9.]" "" WINDOWS_SDK "${WINDOWS_SDK}")
set(${ret} ${WINDOWS_SDK} PARENT_SCOPE)
endfunction() \ No newline at end of file