CMake is unable to identify compiler if it doesn't work without --sysroot, -Bprefix, etc
Some GCC toolchains don't work without --sysroot
or -B<prefix>
flags. For example, if we're using a cross-compiling toolchain and these flags are missing, it may end up using host's as
or ld
, which are incompatible.
IIRC, CMake way of using such toolchains is through "toolchain files", which set correct compiler paths, CMAKE_<LANG>_FLAGS_INIT
, CMAKE_SYSROOT
etc.
However, it seems that compiler identification step doesn't work for such toolchains:
-- The C compiler identification is unknown
-- The CXX compiler identification is unknown
This is a problem because a lot of important variables are not initialized as a result.
If I instead set compiler path to a script wrapper which calls GCC with --sysroot
and -B<prefix>
, compiler identification starts working. But isn't the point of toolchain files not to write such wrappers?