Leon
Leon

Reputation: 2059

how to let KDevelop & CMake only build specific targets?

I'm using KDevelop and CMake to develop a project that includes many targets, including a few of executables and libraries and many unit-tests of them.

Every time when I start to build my project, I have to wait a long time, because KDevelop / CMake always build all the targets defined in CMakeList.txt. Most of the time, I only modified a bit of the codes, and merely want to build a single target to validate whether the modification is correct.

So, my question is:

Is there a way, I can let KDevelop and CMake only build a single or couple of the targets? Thanks!

Upvotes: 2

Views: 455

Answers (1)

Guillaume Racicot
Guillaume Racicot

Reputation: 41780

Usually, projects offer a way to disable tests:

option(MYPROJECT_TEST "Enable tests" OFF)

if(MYPROJECT_TEST)
    add_subdirectory(test)
endif()

Then in the cmake project configuration in KDevelop, a checkbox will appear to enable and disable tests.

Also, in KDevelop itself, there are targets displayed in the project panel. They are represented as a square box with a play symbol in it. You can right click and compile from there to build a single target (and it's required dependencies)

Upvotes: 2

Related Questions