Turning my comments back
Since the CMake error message is misleading, I think this requires a more detailed answer.
In short, you are facing a chicken-and-egg problem.
The discovery of the CMake compiler is great, but since - during the first attempt -
- you did not provide an explicit generator for use with
-G - he could not find the installed Visual Studio.
- he could not find the C / C ++ compiler in the
PATH environment - he could not find the
CC environment variable defined with the full path to the compiler
it was nmake by default.
Now the problem is: it remembers your implicit generator / compiler selection in the variable cache (see CMAKE_GENERATOR in CMakeCache.txt ). Which is a very useful feature if you have several compilers installed.
But if you then declare the CC environment variable - as the error message indicates - it is too late, since your generator selection was saved the first time.
I see two possible options:
- Deselect the generator by setting the correct number with
cmake.exe -G "MinGW Makefiles" .. (as indicated by the answer pointed to by @Guillaume) - Delete the project's binary output directory (including
CMakeCache.txt ) and make cmake.exe .. after adding your bin compiler bin to the PATH environment.
References
- Running CMake on Windows
- What is the default CMake generator on Windows?
- CMake error in CMakeLists.txt: 30 (project): No CMAKE_C_COMPILER can be found
- CMake: how to specify the version of Visual C ++ to work with?
Florian
source share