I am writing a script that will compile a few hundred applications using CMAKE. These applications use various compilers for embedded systems and each has it’s own build instructions. Usually we use compilers on shared network drive, but in order to speed things up I want to check which compiler should be used, cache it locally and override compiler settings via command line.
However, I got stuck on figuring out how to get information about the compiler before the compiler is already used. Specifically, if I perform configure step (after which this information becomes available), this step already does some basic checks with the compiler like Detecting C compiler ABI info
or Check for working C compiler
.
Is there a way to get information about the build project without running the configure step, or at least skip the compiler checks?
I already considered a few things:
-
One option would be to parse the files myself, but I would like to avoid that as it really just duplicates lots of CMake functionality and is very error prone.
-
I was looking at -N (view mode), but it seems like this only outputs useful information after the configure step.
-
I also looked at the cmake-file-api, the toolchain object, but I don’t see how I can use this without invoking the configure step either.
I feel like there should be an easy and efficient way to do this, but I’m just learning CMake and can’t find it. Any help would be appreciated.