我正在嘗試使用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 –