我正在尝试使用Windows 10使用MinGW
来设置cmake
。我已将路径c:/MinGW/bin
包含在我的系统路径和环境路径设置中。我从我的路径中删除了sh.exe
(尽管如果可能,我希望能够保留这一点)。Cmake编译器问题
的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)
输出
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"
看来,GNU编译器被识别,但似乎并没有工作。任何帮助将非常感激。我试图避免使用Cygwin ..但几乎准备好在这里在一秒内走这条路线。
它看起来像cmake配置为微软的工具链,因为它试图运行'nmake'。 –
好吧,也许这是因为我使用Visual Studio代码,我会考虑安装nmake。感谢输入 – SuperVeetz
我宁愿建议告诉cmake使用GNU make而不是MS nmake。尝试'cmake -G“MinGW Makefiles”'而不是'cmake -G“NMake Makefiles”'参见https://cmake.org/Wiki/CMake_Generator_Specific_Information#Makefile_generators –