c++debuggingcmakeconfigurationkdevelop

How to define multi-config in KDevelop with CMake?


I'm working with KDevelop and CMake.

When I need to debug my program, I have to switch the value of "CMAKE_BUILD_TYPE" from "Release" to "Debug" in the Project Configure dialog, and rebuild all programs in order to add debugging symbol info into programs.

When I need to release my program, I have to switch back the value to "Release", and rebuild all things again.

It's tedious and long-waiting to re-build all programs.

Is there a way, by it I can define multiple configurations for my project, and let one conf for "Debug" and another for "Release"?


Solution

  • I'm using KDevelop-5.2.1, but I think this method should be applicable with later versions.

    Open menu: "Project" -> "Open Configuration..." In the "Configure Project" dialog, create a new Configuration for our project. Now we have two Configurations for our project, therefore we can set one for debugging, and another for releasing.