如何从cmake文件创建Code :: Blocks项目? [英] How to create a Code::Blocks project from the cmake file?

查看:127
本文介绍了如何从cmake文件创建Code :: Blocks项目?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想使用Code :: Blocks IDE构建基于CMakeLists.txt文件的C ++项目.以前,我使用Qt Creator,可以在其中直接打开CMakeLists.txt文件,这将创建一个项目.然后,我可以定义构建命令,例如. cmake ../src,然后是make -j8.这将在CMakeLists.txt文件上运行cmake,然后在makefile上运行make.

I would like to use the Code::Blocks IDE to build a C++ project based on a CMakeLists.txt file. Previously, I was using Qt Creator, where I could open a CMakeLists.txt file directly, which would create a project. I could then define the build commands, eg. cmake ../src followed by make -j8. This would run cmake on the CMakeLists.txt file, and then run make on the makefile.

如何在Code :: Blocks中执行类似的操作?如果我尝试创建一个新项目,它使我可以选择创建一个空项目,但随后我就无法确定下一步去做...

How can I do something similar in Code::Blocks? If I try to create a new project, it gives me the option of creating an empty project, but then I am stuck as to where to go next...

推荐答案

相似,但是您必须指定编译器,假设您有一个文件夹project/build和project/src,并且CMakeLists.txt在/project下.然后您的命令应如下所示:

It's similar but you have to specify the compiler, supposing that you have a folder project/build and project/src and your CMakeLists.txt is under /project. Then your commands should be something as the following :

$ cd build/
$ cmake .. -G"CodeBlocks - Unix Makefiles"

您将在/build上创建CodeBlocks项目.

you will have your CodeBlocks project created on the /build.

这篇关于如何从cmake文件创建Code :: Blocks项目?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆