Code::Blocks with cmake

时光毁灭记忆、已成空白 提交于 2019-12-18 21:19:48

问题


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.

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....

Thanks!


回答1:


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"

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



来源:https://stackoverflow.com/questions/37618040/codeblocks-with-cmake

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!