AutoVcpkg: Include Vcpkg toolchain

Include the Vcpkg toolchain file after the installation of the first
package.

When building for the first time from a clean source tree, the Vcpkg
toolchain file does not exist. At the same time CMake is only reading
the toolchain file the very first time it is configuring, but since the
toolchain file is only created when vcpkg is configured on the first
call to vcpkg_install it will never read it. So it is not enough to just
reconfigure.

Note: It is not ideal to include it here since one might at some point
install and search for a package at an erlier point in the script and
fail to find it.

Alternative approaces that I considered:
- Include this file right after including AutoVcpkg. This would require
  1 recompilation for the file to be found and read which is
  unfortunate.
- Include this file in the config function in AutoVcpkg. This seemed
  difficult without including the file for every call to vcpkg_install,
  which seems unecessary.
This commit is contained in:
Eirik Marthinsen 2021-08-29 21:24:48 +01:00 committed by Magne Sjaastad
parent 697da887c4
commit 200d5c65a3

View File

@ -340,6 +340,7 @@ endif() # MSVC
if(VCPKG_AUTO_INSTALL)
vcpkg_install(boost-filesystem)
vcpkg_install(boost-spirit)
include(${CMAKE_TOOLCHAIN_FILE})
endif()
add_subdirectory(ThirdParty/custom-opm-flowdiagnostics)