gpt4 book ai didi

eclipse - 如何更改 Eclipse 中的 cmake 生成器?

转载 作者:行者123 更新时间:2023-12-04 15:47:00 26 4
gpt4 key购买 nike

出于某种原因,当我尝试在 eclipse 中构建时,它会强制使用 -G Ninja。我宁愿 Eclipse 只是不指定 cmake 的 -G 选项,但我无法弄清楚如何配置 Eclipse 来做到这一点。

例如,在我的控制台窗口中:

Building in: /home/bgass/eclipse-workspace/scomlib/build/default
cmake -G Ninja -DCMAKE_BUILD_TYPE=Release -DCMAKE_EXPORT_COMPILE_COMMANDS=ON /home/bgass/eclipse-workspace/scomlib
CMake Error: Error: generator : Ninja
Does not match the generator used previously: Unix Makefiles
Either remove the CMakeCache.txt file or choose a different binary directory.
cmake --build . -- -v
GNU Make 4.2.1
Built for x86_64-redhat-linux-gnu
Copyright (C) 1988-2016 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Build complete (0 errors, 0 warnings): /home/bgass/eclipse-workspace/scomlib/build/default

在终端中,即使没有指定生成器,它也能正常工作。

cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_EXPORT_COMPILE_COMMANDS=ON /home/bgass/eclipse-workspace/scomlib
-- Configuring done
-- Generating done
-- Build files have been written to: /home/bgass/eclipse-workspace/scomlib/build/default

最佳答案

我都是在eclipse外执行cmake,然后在Eclipse中打开生成的eclipse工程。

使用 -G "Eclipse CDT4 - Unix Makefiles" 将 Eclipse 指定为生成器。

以下是全套 Eclipse 生成器。

  Eclipse CDT4 - NMake Makefiles
= Generates Eclipse CDT 4.0 project files.
Eclipse CDT4 - MinGW Makefiles
= Generates Eclipse CDT 4.0 project files.
Eclipse CDT4 - Ninja = Generates Eclipse CDT 4.0 project files.
Eclipse CDT4 - Unix Makefiles= Generates Eclipse CDT 4.0 project files.

键入 cmake --help 以查看您的特定 cmake 版本支持哪些生成器。

关于eclipse - 如何更改 Eclipse 中的 cmake 生成器?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55290446/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com