[SOLVED] Using VCPKG with cmake and Qt 6 for Windows ARM64


Qt 6.2 introduced Windows on Arm support (https://bugreports.qt.io/browse/QTBUG-85820). I tried to create a new cmake project set up using Qt Creator and everything works fine. Then I wanted to add some external packages to my project using vcpkg. The standard way to use vcpkg with cmake is using the CMAKE_TOOLCHAIN_FILE variable (as mentioned here. However, when I clicked on project settings in Qt Creator (Projects > Build) it seems that Qt Creator has already set up the CMAKE_TOOLCHAIN_FILE variable to another file

Qt Creator CMake settings for Qt 6.3.0 MSCV 2019 ARM64

Presumably, this is done so that it is possible to cross-compile an ARM64 binary from a x64 machine. However, this prevents me from setting up vcpkg within my Qt project. Is there a way to get around this issue? Does CMake support multiple toolchain files or is there an alternative setup for my scenario?


I found out that VCPKG provides a way to achieve this as explained here:

To use an external toolchain file with a project using vcpkg, you can set the cmake variable VCPKG_CHAINLOAD_TOOLCHAIN_FILE on the configure line:

cmake ../my/project \
-DCMAKE_TOOLCHAIN_FILE=C:/vcpkg/scripts/buildsystems/vcpkg.cmake \ -DVCPKG_CHAINLOAD_TOOLCHAIN_FILE=../my/project/compiler-settings-toolchain.cmake

So in my case, I can just qt toolchain file using VCPKG_CHAINLOAD_TOOLCHAIN_FILE option.

Answered By – mathripper

Answer Checked By – Cary Denson (BugsFixing Admin)

Leave a Reply

Your email address will not be published. Required fields are marked *