在 CLion 中:CMake 无法找到与“Unix Makefiles”对应的构建程序

问题描述 投票:0回答:2

我正在使用完全远程模式的 CLion 工作。加载cmake项目时出错:

/mnt/home/idmg/lhz/tool/cmake-3.17.5-Linux-x86_64/bin/cmake -DCMAKE_BUILD_TYPE=Debug -G "CodeBlocks - Unix Makefiles" /mnt/home/idmg/lhz/CLionProjects/IOE-SORW
CMake Error: CMake was unable to find a build program corresponding to "Unix Makefiles".  CMAKE_MAKE_PROGRAM is not set.  You probably need to select a different build tool.
CMake Error: CMAKE_C_COMPILER not set, after EnableLanguage
CMake Error: CMAKE_CXX_COMPILER not set, after EnableLanguage
-- Configuring incomplete, errors occurred!
See also "/mnt/home/idmg/lhz/CLionProjects/IOE-SORW/cmake-build-debug-idmg/CMakeFiles/CMakeOutput.log".

[Failed to reload]

但是,当我直接在终端中执行命令时,一切正常:

$ /mnt/home/idmg/lhz/tool/cmake-3.17.5-Linux-x86_64/bin/cmake -DCMAKE_BUILD_TYPE=Debug -G "CodeBlocks - Unix Makefiles" /mnt/home/idmg/lhz/CLionProjects/IOE-SORW
-- The C compiler identification is GNU 7.4.0
-- The CXX compiler identification is GNU 7.4.0
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc - works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ - works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Configuring done
-- Generating done
-- Build files have been written to: /mnt/home/idmg/lhz/CLionProjects/IOE-SORW/cmake-build-debug-idmg

我对此感到困惑,因此 CLion 中未显示此 CMake 配置文件。我该如何解决这个问题?

c++ linux makefile cmake clion
2个回答
0
投票

有同样的问题。作为一种解决方法,可以建议在终端中手动生成 cmake 缓存,然后 CLion 可以使用设置了 CMAKE_MAKE_PROGRAM 的现有缓存。

CLion 2021.1.1 全远程模式。 远程:ubuntu18.04 docker容器


0
投票

我遇到了同样的问题,这就是我解决它的方法: 转到 Settings -> Build, Execution, Deployment -> Toolchains -> -> Build Tool 并输入

make
程序的完整路径,例如
/usr/bin/make
。然后重置cmake缓存并重新加载。

© www.soinside.com 2019 - 2024. All rights reserved.