Reputation: 132260
Suppose I have a system with multiple C/C++ compilers - various versions of GCC, clang and ICC. Also suppose I have a CMake C/C++ project which has certain requirements and certain preferences regarding the C/C++ compiler to use; and to complicate things, suppose these requirements and preferences and generated dynamically based on the combination of project options I've set (with ccmake
or otherwise).
Now, other answers about using a compiler other than the default suggest setting the CC or CXX environment variables - but this is clearly inappropriate here.
Is there a way to get CMake to:
Notes:
Upvotes: 4
Views: 476
Reputation: 23441
Historically, and probably also technically, the C compiler is very basic to the CMake run. Many commands rely on having a compiler, like detecting symbols or trying to compile a piece of code.
As far as I know, there is no way to tests multiple compilers and chose one. To get this, you have to
My advice: Accept the way CMake works and teach it to your users.
Upvotes: 1