This error message commonly occurs when CMake is unable to locate a valid C++ compiler on the system. This can happen if the compiler is not installed, or if it is installed but its location is not included in the system path.
To resolve this error, you will need to ensure that a valid C++ compiler is installed on the system and its location is included in the system path. You can check the availability of a C++ compiler by running the following command in a terminal:
$ g++ --version
If the command returns a version number, then the compiler is installed and you can add its location to the system path by modifying the PATH environment variable. For example, on Linux/MacOS systems, you can add the following line to your bash profile:
export PATH=/usr/local/bin:$PATH
On Windows systems, you can modify the system path by going to Control Panel > System and Security > System > Advanced system settings > Environment Variables and editing the Path variable.
Once a valid C++ compiler has been installed and added to the system path, you should be able to run CMake without encountering the “No CMAKE_CXX_COMPILER could be found” error.