Debugger problem with CMake project
I’m unable to use the debugger with CMake projects, it ignores the breakpoints because the executable is build without debugging info. Imported project has only one configuration (there are no Debug and Release configurations)
The way around this is to create a custom build step that runs before make. It should invoke cmake.exe passing “-DCMAKE_BUILD_TYPE=Debug .” as an argument.
Why is this needed? Is there something I can add to my CMakeLists.txt to configure this properly and have both Debug and Release configurations?
You are free to set up several build directories, each with a different configuration (e.g. one debug one release). Switching between configurations is then a matter of changing the build directory. As far as I know there is no way to automatically set up several build directories at once with cmake.
If you are using Qt Creator: The IDE could in theory do that for you, but currently does not. Patches to improve cmake support are welcome.