setCMAKECXXCOMPILER
setCMAKECXXCOMPILER is not a separate CMake command; the relevant variable is CMAKE_CXX_COMPILER. This variable stores the full path to the C++ compiler that CMake will use for building C++ targets. It is intended to be set before the project is configured, so that CMake can select and configure the build with the desired compiler.
Ways to set it include passing it on the configure command line, using a toolchain file, or
Notes and caveats: CMAKE_CXX_COMPILER must be set before enabling languages or calling project(). If you set
In summary, CMAKE_CXX_COMPILER specifies the C++ compiler CMake uses, and should be configured prior to project()