cmake cross compile setup

Cross compiling using the Linux Kernel Makefile way seems super easy to me.

One sets the CROSS_COMPLE=/some/path/to/your-tripple-name-
and it just works.

ie: set(CROSS_COMPILE “/some/absolute/path/to/special/gcc/foo-bar-thang-”)

As an Example - XILINX Microblaze compiler or the XIILNX ARM, or - for Microsemi/Microchip - their RISCV compiler - each of these come in the tool vendors installation package - they are NOT in my path.

Is there any way to make CMAKE understand CROSS_COMPILE?

In my case - I am targeting multiple different CPUs - all use GCC,and I would really like to be able to just set the ONE or TWO variables and call some cmake file that takes care of the rest of the process - CMAKE does not need to FIND the damn compiler I’m telling it exactly where it is located by an absolute path.

ie:

tell the MACRO the prefix for GCC… ie: arm-non-eabi- )

set( CMAKE_CROSS_COMPILE_PREFIX “/some/absolute/path/arm-none-eabi-”)

This might set like: -fcpu=cortexm4 or hard/soft float options and -std=c11

set( CMAKE_CROSS_CFLAGS “… flags specific to this cross compiler …”)

Same but for C++

set( CMAKE_CROSS_CXXFLAGS “… flags specific to this cross compiler …”)

#then simply include some predefined thing that does the rest of the magic?
include( cmake-cross-compile-via-gcc )