Add option to easily set the toolchain
I would like there to be an option to easily specify the toolchain like: CMAKE_USE_TOOLCHAIN
It may be used like this:
-
-DCMAKE_USE_TOOLCHAIN="MSVC"
specifies to use the msvc toolchain regardles of the VS version -
-DCMAKE_USE_TOOLCHAIN="MSVC 2019"
specifies to use the msvc toolchain of VS2019 -
-DCMAKE_USE_TOOLCHAIN="Clang"
specifies to use the clang toolchain -
-DCMAKE_USE_TOOLCHAIN="Clang-cl"
specifies to use the clang-cl toolchain -
-DCMAKE_USE_TOOLCHAIN="GCC"
specifies to use the gnu toolchain
I would prefer this over the current CMAKE_<lang>_COMPILER
option, since it requires to set the C and C++ compilers seperately and if you have multiple versions of the compiler on the path (like VS2017 and VS2019) you have to specify the absolute path, which is annoying and not portable.
It should result in an error, if the requested toolchain is not available.
Edited by Jonas Gilg