This template can be used in order to cross-compile for ARM or specific for the Raspberry PI. In addition, it explains how to include external dependencies for cross-compiling.
git clone https://github.com/raspberrypi/tools.git /home/<yourusername>/rpi-tools
git clone https://github.com/Rodiii/cmake_crosscompiling_template
In cmake_crosscompiling_template/toolchain-arm.cmake replace with the path where you cloned the rpi-tools to. Please don’t use ~ here.
mkdir build_arm
cd build_arm
cmake -G 'Unix Makefiles' -DCMAKE_BUILD_TYPE=Debug -DCMAKE_TOOLCHAIN_FILE=../toolchain-arm.cmake ..
make -j 8
A complete tutorial can be found here: Tutorial