I\'ve done a lot of research and been unable to find an answer to this... how can I reliably find the target architecture I\'m compiling for, using CMake? Basically, the equ
This is a well tested way of knowing the host architecture:
# Store in CMAKE_DEB_HOST_ARCH var the current build architecture
execute_process(COMMAND
dpkg-architecture
-qDEB_HOST_ARCH
OUTPUT_VARIABLE
CMAKE_DEB_HOST_ARCH
OUTPUT_STRIP_TRAILING_WHITESPACE
)
And use that information later in CMakeLists as you need
if(${CMAKE_DEB_HOST_ARCH} MATCHES "armhf")
...
elseif(${CMAKE_DEB_HOST_ARCH} MATCHES "i386")
...
else()
...
endif()