I am deploying a small application to several different systems (mac, linux, linux64) where it needs to be compiled. I would like to tell cmake to the latest gcc available in a particular system. For example, Mac 10.6 has gcc 4.0 and gcc 4.2 (default). But some users have also gcc 4.4 installed through MacPorts (it is not the default). I would like cmake to use gcc44 in this case. In other linux systems, the latest gcc is 4.4 or 4.5 What is the more robust way to achieve this?
Thanks,
H
CMake honors the environment variables
CCandCXXupon detecting the C and C++ compiler to use. E.g., if those variables point to clang, it will use clang by default:You could either define these as system wide environment variables pointing to the preferred compilers or write a small shell wrapper script which tests the availability of several compilers and sets the variables accordingly before invoking cmake.