如何为 cmake 配置 Eclipse CDT? [英] How to configure Eclipse CDT for cmake?
问题描述
如何使用插件 CDT 为 cmake 配置 EclipseHelios"?
How to configure Eclipse "Helios" with plugin CDT for cmake?
cmake all
CMake Error: The source directory "D:/javaworkspace/workspace/Planner/Debug/all" does not exist.
Eclipse 总是想使用 'all' 选项,我不知道如何阻止它不使用它.
Eclipse always wants to use 'all' option and I don't know how to stop its to not use it.
我已经看到在构建行为"部分,在首选项"中有全部"选项.我删除了这个,但它仍然工作错误(同样的错误).
I've seen that in "Build behavior" section, in "Preference" there have been 'all' option. I erased this, but it still works wrong (this same error).
推荐答案
在 Eclipse-CDT 中,您不必创建 cmake 项目,而是导入 cmake 项目.这是你应该做的:
In Eclipse-CDT you do not create cmake projects but you import cmake projects. This is what you should do:
说出名为Planner"的 CMake 项目的源代码;位于
D:/javaworkspace/src/Planner
创建文件夹(文件夹需要相互平行):D:/javaworkspace/build/Planner
Create a folder (the folders NEED to be parallel to each other): D:/javaworkspace/build/Planner
转到文件夹 D:/javaworkspace/build/Planner
并使用 Eclipse 生成器运行 CMake:
Go to the folder D:/javaworkspace/build/Planner
and run CMake using the Eclipse generator:
cmake ../../src/Planner -G"Eclipse CDT4 - Unix Makefiles"
这将为您的 Planner 项目生成 make 文件.
This will generate the make files for your Planner project.
要在 Eclipse 中导入它,请执行以下操作:
To import this in Eclipse do the following:
文件 ->导入 ->C/C++ ->现有代码作为 Makefile 项目
File -> Import -> C/C++ -> Existing code as Makefile project
并选择 D:/javaworkspace/build/Planner
(带有 make 文件的构建输出文件夹)作为现有代码位置"
and select D:/javaworkspace/build/Planner
(the build output folder with the make files) as the "Existing Code location"
但是,查看您的路径,在我看来您正在使用 Windows.在 windows CMake 中可以生成 Visual Studio 项目.如果您想使用 CMake,我建议您首先创建一个hello world";使用 CMake 的项目(记住,Eclipse 不会创建 CMake 项目,你必须手动创建一个 CMakeLists.txt 文件)
However, looking at your paths it seems to me that you are working on Windows. In windows CMake can generate Visual Studio projects. If you want to use CMake I suggest first creating a "hello world" project using CMake (remember, Eclipse does not create CMake projects, you have to create a CMakeLists.txt file by hand)
这篇关于如何为 cmake 配置 Eclipse CDT?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!