Skip to content

CMake plugin: Show a message box if configuration fails

Currently, if KDevelop fails to run the CMake configure step to obtain the include paths in a CMake project, users may easily overlook it. There will be an error message in the log at the bottom of the window, but it can be easy to overlook. This merge request makes KDevelop show a helpful error message which alerts users to the problem. While I am not at all a fan of having such message boxes pop up, this ensures that the user will be aware of the problem and it should not happen frequently.

Another issue that needs to be addressed is that KDevelop does not seem to pick up changes to CMakeLists.txt automatically at the moment. It is required to open the project configuration and close it again to repeat the configure process.

Edit: Actually, once this is fixed as well, another solution may need to be implemented for showing configuration errors, since then the configure step may be called more often such that the message box may become annoying.

Edit2: Some more testing showed that KDevelop actually does pick up changes to CMakeLists.txt files automatically contrary to my previous belief. But it does so only as long as the configuration is always correct. Once it tries to load an invalid configuration (for example having an error in a CMakeLists.txt file), this stops working.

Edit3: I updated the merge request now to also show a message if the configuration becomes invalid due to a change to a CMakeLists.txt file, and added the instruction to the message text to reload the project manually. For the future, it seems desirable to continue watching the files ourselves that the CMake server seemingly stops watching once there is an error. But the current solution proposed here should at least alert the users to the problem and tell them how to fix it.

Edited by Thomas Schöps

Merge request reports