I hope it’s alright to respond to this older email thread.
We have been trying to follow above suggestion, since we have multiple repositories which we would like to build independently using a cross-compiler toolchain, and we would like to eliminate duplication of the toolchain files among those various repositories.
So I tried putting the FetchContent_Declare and FetchContent_MakeAvailable of the repo that contains the toolchain files above the first Project statement. However, FetchContent_MakeAvailable first creates its repo-subbuild directory from which it will eventually download the targeted repo, but that repo-subbuild directory contains a CMakeLists with a “project(repo-populate NONE)” command. This project command initiates loading the toolchain, which is not yet downloaded.
Is there a way around this? Theoretically, that project does not list any languages, so CMake could choose to not load the toolchain. But according to the documentation of “project”, the toolchain file is loaded at least once.
Could it be the case that this behaviour was recently changed? Or is this just happening when using Visual Studio’s CMake? Is there still another thing that I need to do in order to have a repository with toolchain files being made available with FetchContent?