问题
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