Hello. Despite the information in toolchain file, CMake chooses host libraries instead of the target ones.
My toolchain looks like that:
set(CMAKE_SYSTEM_NAME Linux)
set(CMAKE_SYSTEM_PROCESSOR arm)
set(triple arm-linux-gnueabihf)
set(CMAKE_C_COMPILER_TARGET ${triple})
set(CMAKE_CXX_COMPILER_TARGET ${triple})
set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
I invoke the configuration command as:
CC=arm-linux-gnueabihf-gcc-10 CXX=arm-linux-gnueabihf-g++-10 cmake .. -DCMAKE_BUILD_TYPE=Release -DCMAKE_TOOLCHAIN_FILE="$(realpath ../toolchain.cmake)"
The process starts, and at some point i see
-- Found OpenSSL: /usr/lib/x86_64-linux-gnu/libcrypto.so (found version "1.1.1i")
which is obviously wrong. I have installed libssl-dev with:
sudo apt install libssl-dev:armhf
and indeed it lives alongside the host libssl:
$ find /usr/ -name libcrypto.so
/usr/lib/x86_64-linux-gnu/libcrypto.so
/usr/lib/arm-linux-gnueabihf/libcrypto.so
Why is CMake picking the wrong triplet even tho it is explicitly set, and it’s the default compiler triplet? I am a debian user, from what I’ve read CMake is adapted to the way debian multiarch works. Where is a mistake?