Skip to content

Commit 2844642

Browse files
authored
Merge pull request #3 from CaptainHorse/master
Don't include toolchain before bootstrapping
2 parents f427fb9 + 695e3e5 commit 2844642

File tree

1 file changed

+19
-20
lines changed

1 file changed

+19
-20
lines changed

automate-vcpkg.cmake

Lines changed: 19 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -81,34 +81,33 @@ if (WIN32)
8181
endif()
8282
endif()
8383

84-
# Find out whether the user supplied their own VCPKG toolchain file
85-
if(NOT DEFINED ${CMAKE_TOOLCHAIN_FILE})
86-
if(NOT DEFINED ENV{VCPKG_ROOT})
87-
if(WIN32)
88-
set(VCPKG_ROOT ${VCPKG_FALLBACK_ROOT})
89-
else()
90-
set(VCPKG_ROOT ${VCPKG_FALLBACK_ROOT})
91-
endif()
84+
if(NOT DEFINED ENV{VCPKG_ROOT})
85+
if(WIN32)
86+
set(VCPKG_ROOT ${VCPKG_FALLBACK_ROOT})
9287
else()
93-
set(VCPKG_ROOT $ENV{VCPKG_ROOT})
88+
set(VCPKG_ROOT ${VCPKG_FALLBACK_ROOT})
9489
endif()
95-
96-
# We know this wasn't set before so we need point the toolchain file to the newly found VCPKG_ROOT
97-
set(CMAKE_TOOLCHAIN_FILE ${VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake CACHE STRING "")
98-
99-
# Just setting vcpkg.cmake as toolchain file does not seem to actually pull in the code
100-
include(${VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake)
101-
102-
set(AUTOMATE_VCPKG_USE_SYSTEM_VCPKG OFF)
10390
else()
104-
# VCPKG_ROOT has been defined by the toolchain file already
105-
set(AUTOMATE_VCPKG_USE_SYSTEM_VCPKG ON)
91+
set(VCPKG_ROOT $ENV{VCPKG_ROOT})
10692
endif()
10793

108-
10994
# Installs a new copy of Vcpkg or updates an existing one
11095
macro(vcpkg_bootstrap)
11196
_install_or_update_vcpkg()
97+
98+
# Find out whether the user supplied their own VCPKG toolchain file
99+
if(NOT DEFINED ${CMAKE_TOOLCHAIN_FILE})
100+
# We know this wasn't set before so we need point the toolchain file to the newly found VCPKG_ROOT
101+
set(CMAKE_TOOLCHAIN_FILE ${VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake CACHE STRING "")
102+
103+
# Just setting vcpkg.cmake as toolchain file does not seem to actually pull in the code
104+
include(${VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake)
105+
106+
set(AUTOMATE_VCPKG_USE_SYSTEM_VCPKG OFF)
107+
else()
108+
# VCPKG_ROOT has been defined by the toolchain file already
109+
set(AUTOMATE_VCPKG_USE_SYSTEM_VCPKG ON)
110+
endif()
112111

113112
message(STATUS "Automate VCPKG status:")
114113
message(STATUS " VCPKG_ROOT.....: ${VCPKG_ROOT}")

0 commit comments

Comments
 (0)