Yocto SDK with cmake toolchain file

I'd like to add to Anders answer that while it worked great for me to add nativesdk-cmake this way it did not work when I tried to add nativesdk-python3-numpy. After some googling I found this, suggesting that TOOLCHAIN_HOST_TASK has to be extended using _append instead of +=.


Assuming that you're using the image based SDK, i.e. building it with bitbake <image> -c populate_sdk, adding the following toimage.bb should fix it:

TOOLCHAIN_HOST_TASK += "nativesdk-cmake"

That should give you a OEToolchainConfig.cmake file in the SDK. After sourcing the SDK environment file, cmake will be an alias to cmake -DCMAKE_TOOLCHAIN_FILE=$OECORE_NATIVE_SYSROOT/usr/share/cmake/OEToolchainConfig.cmake to further help your developers.