[英]Using cmake with Code::Blocks
I have just started using Code::Blocks for editing C++ code, having used Qt Creator up until now.我刚刚开始使用 Code::Blocks 来编辑 C++ 代码,到目前为止一直使用 Qt Creator。 I want to be able to edit and compile some existing code, which comes with a CMakeLists.txt file.
我希望能够编辑和编译一些现有代码,这些代码带有 CMakeLists.txt 文件。 How can I do this?
我怎样才能做到这一点?
With Qt Creator, you could specify a script which would be run when "Build" was clicked from the menu.使用 Qt Creator,您可以指定一个脚本,当从菜单中单击“构建”时将运行该脚本。 For example, you might specify "cmake ../src", and then "make".
例如,您可以指定“cmake ../src”,然后指定“make”。 Is there a way to do this using Code::Blocks?
有没有办法使用 Code::Blocks 做到这一点?
You can use CMake to create a Code::Blocks project for you:您可以使用 CMake 为您创建一个 Code::Blocks 项目:
cmake -G "CodeBlocks - Unix Makefiles" ../src
This will produce a cbp
project file, which you can just open with Code::Blocks.这将生成一个
cbp
项目文件,您可以使用 Code::Blocks 打开该文件。 What to do when clicking on "Compile", "Run", and so on, will have been set automatically by CMake.单击“编译”、“运行”等时要执行的操作将由 CMake 自动设置。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.