相关疑难解决方法(0)

无法使用CMake指定编译器

我有这个CMakeLists.txt文件的问题:

cmake_minimum_required(VERSION 2.6)

SET(CMAKE_C_COMPILER C:/MinGW/bin/gcc)
SET(CMAKE_CXX_COMPILER C:/MinGW/bin/g++)

project(cmake_test)

add_executable(a.exe test.cpp)
Run Code Online (Sandbox Code Playgroud)

使用:调用cmake cmake -G "MinGW Makefiles",它失败并显示以下输出:

c:\Users\pietro.mele\projects\tests\buildSystem_test\cmake_test>cmake -G "MinGW Makefiles" .
-- The C compiler identification is GNU 4.6.1
-- The CXX compiler identification is GNU 4.6.1
-- Check for working C compiler: C:/MinGW/bin/gcc
CMake Error: your C compiler: "C:/MinGW/bin/gcc" was not found.   Please set CMAKE_C_COMPILER to a valid compiler path or name.
CMake Error: Internal CMake error, TryCompile configure of cmake failed
-- Check for working C …
Run Code Online (Sandbox Code Playgroud)

gcc mingw cmake

43
推荐指数
2
解决办法
10万
查看次数

标签 统计

cmake ×1

gcc ×1

mingw ×1