AspiringMat
AspiringMat

Reputation: 2269

Do you need to make after CMake?

It's my first time building a library manually so I just want to verify something. Sometimes, I run Cmake as:

cmake -SOME_SWITCH=ON ..

And this runs fairly quickly. However, after that, I run:

sudo make

Which takes a really long time (30-40 Minutes).

So my question is, if I do after that CMake again with:

cmake -SOME_SWITCH=ON -SWITCH2=ON ..

Do I need to Make again? And if so, is there a way to not have to go through the entire make again (I.e. only compile the new entries?)

Thanks!

Upvotes: 0

Views: 6045

Answers (1)

Stephen Newell
Stephen Newell

Reputation: 7863

CMake isn't a build system, it's a build system generator. This is why (to answer your first question), you need to invoke make after running cmake; running cmake generates Makefiles with the appropriate dependencies, flags, blah blah blah, and running make actually uses them.

As to your second question, you shouldn't have to rebuild the entire project again unless something changed that affects the entire project (e.g., you changed cflags or modified a header that everything includes). After you've run cmake, keep the build directory around and you should be able to just run make (it'll detect if a CMakeLists.txt file changed and cmake needs to be invoked again).

Upvotes: 5

Related Questions