I hope that this fits here!
I would like to find a list of all compilers that are installed on the system. I tried to use the trace functionality to manually read through everything cmake does to find stuff.
I also found the variable CMAKE_CXX_COMPILER_LIST
. For me they seem to contain a static list of most common compilers that exist, even if they are not installed.
For my application detecting all installed compilers is not crucial and would be only used to for a “nice to have” feature that is not necessary for anything.
So is there a default way to get a list of all installed compilers?
Just to satisfy the curiosity what that mysterious feature could be, I will explain what I was planning to do.
I was working as a volunteer in a group that built robots in an educational context and there was one guy that always claimed we were dumb, because we used gcc and clang would be much better and would generate much faster code… (Maybe in some rare edge cases this could be true, but we were dealing with unoptimized debug build!)
So I built a pretty simple sample project, that had similar code to our codebase, which had features reaching from C++04 to C++14. Later they added some C++17 features in some places and parts of the codebase were ported over from really old C#.
I then added options for most of the features and things and used a python script to iterate over all possible values of all options and a list of compilers consisting of gcc and clang.
For every set of options and every compiler the project was built and a set of test and benchmarks was run.
My script then recorded times and test results and accumulated them into a csv file.
I hope everybody suspects the results.
Now I am building a framework of cmake and python scripts that helps to do things faster and simpler. For that I would like to include some code to suggest the best compiler for a project and would like to auto detect the available compilers and dump all options.
If there is no reasonable way to detect the compilers inside cmake, I could just dump the CMAKE_CXX_COMPILER_LIST
variable and test everyone from the list in python.
Thanks for your time