cmake: Add vcpkg update and upgrade.

In the vcpkg module, call vcpkg update to update the portfiles and vcpkg
upgrade to upgrade any installed ports to make sure we are using the
latest versions.

Signed-off-by: Rafael Kitover <rkitover@gmail.com>
This commit is contained in:
Rafael Kitover 2019-12-03 18:59:42 +00:00
parent b917933013
commit 198e2467dd
No known key found for this signature in database
GPG Key ID: 08AB596679D86240
1 changed files with 20 additions and 9 deletions

View File

@ -71,19 +71,30 @@ if(VCPKG_TARGET_TRIPLET)
list(APPEND VCPKG_DEPS_QUALIFIED ${pkg}:${VCPKG_TARGET_TRIPLET})
endforeach()
# build our deps
if(WIN32)
execute_process(
COMMAND vcpkg install ${VCPKG_DEPS_QUALIFIED}
WORKING_DIRECTORY ${VCPKG_ROOT}
)
set(vcpkg_exe vcpkg)
else()
execute_process(
COMMAND ./vcpkg install ${VCPKG_DEPS_QUALIFIED}
WORKING_DIRECTORY ${VCPKG_ROOT}
)
set(vcpkg_exe ./vcpkg)
endif()
# update portfiles
execute_process(
COMMAND ${vcpkg_exe} update
WORKING_DIRECTORY ${VCPKG_ROOT}
)
# build our deps
execute_process(
COMMAND ${vcpkg_exe} install ${VCPKG_DEPS_QUALIFIED}
WORKING_DIRECTORY ${VCPKG_ROOT}
)
# make sure we have the latest versions
execute_process(
COMMAND ${vcpkg_exe} upgrade --no-dry-run
WORKING_DIRECTORY ${VCPKG_ROOT}
)
if(WIN32 AND VCPKG_TARGET_TRIPLET MATCHES x64)
set(CMAKE_GENERATOR_PLATFORM x64 CACHE STRING "visual studio build architecture" FORCE)
endif()