CMAKE_C_COMPILER 未设置,在 EnableLanguage 之后
CMAKE_C_COMPILER not set, after EnableLanguage
除了 gcc 和 g++ 编译器之外,我还在 windows 上安装了 CMake
我将变量添加到路径中,但仍然出现以下错误,请您帮忙。
-- Building for: NMake Makefiles
CMake Error at CMakeLists.txt:6 (project):
Running
'nmake' '-?'
failed with:
The system cannot find the file specified
CMake Error: CMAKE_C_COMPILER not set, after EnableLanguage
CMake Error: CMAKE_CXX_COMPILER not set, after EnableLanguage
-- Configuring incomplete, errors occurred!
See also "C:/Users/DEANHOS/Desktop/peer/cmake tutorial/codeAndTech/sample/CMakeFiles/CMakeOutput.log".
这些变量需要在命令行上传递为:
$ cmake -DCMAKE_CXX_COMPILER=/pathto/g++ -DCMAKE_C_COMPILER=/pathto/gcc /pathto/source
或者在CMakeLists.txt中的project()
行之前设置:
set( CMAKE_CXX_COMPILER "/pathto/g++" )
set( CMAKE_C_COMPILER "/pathto/gcc" )
project(mytest)
...
或者用 -C <toolchain>
命令作为
引入
# mygcc.cmake
# toolchain file
set( CMAKE_CXX_COMPILER "/pathto/g++" )
set( CMAKE_C_COMPILER "/pathto/gcc" )
$ cmake -C /pathto/mygcc.cmake /pathto/source
除了 gcc 和 g++ 编译器之外,我还在 windows 上安装了 CMake 我将变量添加到路径中,但仍然出现以下错误,请您帮忙。
-- Building for: NMake Makefiles
CMake Error at CMakeLists.txt:6 (project):
Running
'nmake' '-?'
failed with:
The system cannot find the file specified
CMake Error: CMAKE_C_COMPILER not set, after EnableLanguage
CMake Error: CMAKE_CXX_COMPILER not set, after EnableLanguage
-- Configuring incomplete, errors occurred!
See also "C:/Users/DEANHOS/Desktop/peer/cmake tutorial/codeAndTech/sample/CMakeFiles/CMakeOutput.log".
这些变量需要在命令行上传递为:
$ cmake -DCMAKE_CXX_COMPILER=/pathto/g++ -DCMAKE_C_COMPILER=/pathto/gcc /pathto/source
或者在CMakeLists.txt中的project()
行之前设置:
set( CMAKE_CXX_COMPILER "/pathto/g++" )
set( CMAKE_C_COMPILER "/pathto/gcc" )
project(mytest)
...
或者用 -C <toolchain>
命令作为
# mygcc.cmake
# toolchain file
set( CMAKE_CXX_COMPILER "/pathto/g++" )
set( CMAKE_C_COMPILER "/pathto/gcc" )
$ cmake -C /pathto/mygcc.cmake /pathto/source