Building Swift with custom cmake toolchain?

In our downstream implementation, we use package managers like vcpkg or Conan, that provides its own cmake toolchain file, that we pass into the build with:


However, starting from 5.9.0, we noticed that swift-syntax start to break, and digging into the build logs reveals that it's missing CMAKE_Swift_COMPILER_TARGET, which is supposed to be set by the CMake toolchain generated by Swift's buildsystem, yet unfortunately get overridden by our custom cmake toolchain options.


1 Like

For now, I workaround this issue locally by applying:


However a method to programmatically obtain the path of BuildScriptToolchain.cmake is required

1 Like