cmake: update vcpkg mod for appveyor build cache
On appveyor we only cache the `vcpkg/installed` directory, so vcpkg itself still needs to be pulled from git. Also update vcpkg from git if it has already been cloned, and always rebuild vcpkg itself. Signed-off-by: Rafael Kitover <rkitover@gmail.com>
This commit is contained in:
parent
0535d5c797
commit
c06e3bf3fc
|
@ -16,25 +16,55 @@ if(VCPKG_TARGET_TRIPLET)
|
|||
)
|
||||
|
||||
if(NOT git_status EQUAL 0)
|
||||
message(FATAL_ERROR "Error cloning vcpkg, please make sure git for windows is installed correctly, it can be installed from Visual Studio components")
|
||||
message(FATAL_ERROR "Error cloning vcpkg from git, please make sure git for windows is installed correctly, it can be installed from Visual Studio components")
|
||||
endif()
|
||||
else()
|
||||
# this is the case when we cache vcpkg/installed with the appveyor build cache
|
||||
if(NOT EXISTS ${VCPKG_ROOT}/.git)
|
||||
set(git_commands
|
||||
"git init"
|
||||
"git remote add origin https://github.com/microsoft/vcpkg.git"
|
||||
"git fetch --all --prune"
|
||||
"git reset --hard origin/master"
|
||||
"git branch --set-upstream-to=origin/master master"
|
||||
)
|
||||
foreach(git_command ${git_commands})
|
||||
separate_arguments(git_command)
|
||||
|
||||
execute_process(
|
||||
COMMAND ${git_command}
|
||||
RESULT_VARIABLE git_status
|
||||
WORKING_DIRECTORY ${VCPKG_ROOT}
|
||||
)
|
||||
|
||||
if(NOT git_status EQUAL 0)
|
||||
break()
|
||||
endif()
|
||||
endforeach()
|
||||
else()
|
||||
execute_process(
|
||||
COMMAND git pull --rebase
|
||||
RESULT_VARIABLE git_status
|
||||
WORKING_DIRECTORY ${VCPKG_ROOT}
|
||||
)
|
||||
endif()
|
||||
|
||||
if(NOT git_status EQUAL 0)
|
||||
message(FATAL_ERROR "Error updating vcpkg from git, please make sure git for windows is installed correctly, it can be installed from Visual Studio components")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# build vcpkg if not built
|
||||
# build latest vcpkg
|
||||
if(WIN32)
|
||||
if(NOT EXISTS ${VCPKG_ROOT}/vcpkg.exe)
|
||||
execute_process(
|
||||
COMMAND bootstrap-vcpkg.bat
|
||||
WORKING_DIRECTORY ${VCPKG_ROOT}
|
||||
)
|
||||
endif()
|
||||
execute_process(
|
||||
COMMAND bootstrap-vcpkg.bat
|
||||
WORKING_DIRECTORY ${VCPKG_ROOT}
|
||||
)
|
||||
else()
|
||||
if(NOT EXISTS ${VCPKG_ROOT}/vcpkg)
|
||||
execute_process(
|
||||
COMMAND ./bootstrap-vcpkg.sh
|
||||
WORKING_DIRECTORY ${VCPKG_ROOT}
|
||||
)
|
||||
endif()
|
||||
execute_process(
|
||||
COMMAND ./bootstrap-vcpkg.sh
|
||||
WORKING_DIRECTORY ${VCPKG_ROOT}
|
||||
)
|
||||
endif()
|
||||
|
||||
foreach(pkg ${VCPKG_DEPS})
|
||||
|
|
Loading…
Reference in New Issue