On 5/29/2021 2:06 PM, Peter Dimov via Boost wrote:
Edward Diener wrote:
Thanks, Peter, but how do I tell CMake to use a particular compiler ? In b2 I specify the toolset on the b2 command line. In CMake I specify what ?
There are various ways to control that but the easiest is to set the CC and CXX environment variables (on POSIX platforms.)
Again, when on Windows, things are a bit different. There you need to specify the toolset with -T when using the default Visual Studio generator (or select a generator with -G.)
https://cmake.org/cmake/help/v3.20/manual/cmake.1.html
CMake's philosophy is very different from b2's.
OK, I will bite <g>. // Beginning of rant The difficulty of specifying a compiler to use with CMake, compared with the elegance of b2's toolset definitions, makes me really wonder why the majority of the C++ world considers CMake anything but software gone terribly wrong. I know b2 has some abstruse weaknesses, but specifying a toolset/definition is not one of them. Maybe I have missed something but I certainly do not see how some CMake generator equates to a particular compiler other than the Visual C++ generators, where each generator name equates to a particular version of VC++. There must be more I am missing but there is not anything in the CMake documentation I can find which explains to me how I can specify, for instance, a particular version of mingw-w64 gcc or clang on Windows for CMake to use. The explanation for the CMake generators at https://cmake.org/cmake/help/v3.20/manual/cmake-generators.7.html#manual:cma...) is so pathetic that if I did not know the majority of C++ programmers swear by CMake I would really have thought that such software documentation would have doomed such software for popular use eons ago. // End of rant