Cmake Compiler Issue
10,571
To fix the problem I was having, I had to do two things.
- use the command
cmake -G "MinGW Makefiles" .
(capital -G on windows) - update my
CMakeLists.txt
file to use gcc for C compiler and g++ for C++ compiler
CMakeLists.txt
cmake_minimum_required(VERSION 3.8)
set(CMAKE_C_COMPILER "C:/MinGW/bin/gcc.exe")
set(CMAKE_CXX_COMPILER "C:/MinGW/bin/g++.exe")
project (Tutorial)
add_executable(Tutorial tutorial.cpp)
Comments
-
SuperVeetz almost 2 years
I am trying to setup
cmake
using Windows 10 usingMinGW
. I have included the pathc:/MinGW/bin
in my system path and environment path settings. I have removedsh.exe
from my path (although, i would love to be able to keep this if possible).CMakeLists.txt
cmake_minimum_required(VERSION 3.8) set(CMAKE_C_COMPILER "C:/MinGW/bin/gcc.exe") set(CMAKE_CXX_COMPILER "C:/MinGW/bin/gcc.exe") project (Tutorial) add_executable(Tutorial tutorial.cpp)
Output
C:\School\athabascua\data structures\ass1>cmake -g "MinGW Makefiles" . -- The C compiler identification is GNU 5.3.0 -- The CXX compiler identification is GNU 5.3.0 -- Check for working C compiler: C:/MinGW/bin/gcc.exe CMake Error: Generator: execution of make failed. Make command was: "nmake" "/NOLOGO" "cmTC_b3144\fast" -- Check for working C compiler: C:/MinGW/bin/gcc.exe -- broken CMake Error at C:/Program Files/CMake/share/cmake-3.8/Modules/CMakeTestCCompiler.cmake:51 (message): The C compiler "C:/MinGW/bin/gcc.exe" is not able to compile a simple test program. It fails with the following output: Change Dir: C:/School/athabascua/data structures/ass1/CMakeFiles/CMakeTmp Run Build Command:"nmake" "/NOLOGO" "cmTC_b3144\fast" Generator: execution of make failed. Make command was: "nmake" "/NOLOGO" "cmTC_b3144\fast"
It seems that the GNU compilers are identified but don't seem to work. Any help would be much appreciated. I am trying to avoid using Cygwin.. but almost ready to go that route in a sec here.