cmakekdevelop

Can Kdevelop 5.0 still load existing external cmake project


I know that KDevelop 4 was able to import CMake projects (hand written CMakeLists.txt not generated by KDevelop) ... but now after I installed ubuntu 18.04 it seems this is not possible anymore (the Project > Open/Import Project dialog simply refuse take CMakeLists.txt when I click on it )? Or I miss something?

I tried to run cmake .. -DCMAKE_EXPORT_COMPILE_COMMANDS as described here but it refuse with error message:

prokop@s2-041:~/git/SimpleSimulationEngine/cpp/Build$ cmake .. -DCMAKE_EXPORT_COMPILE_COMMANDS
Parse error in command line argument: -DCMAKE_EXPORT_COMPILE_COMMANDS
Should be: VAR:type=value
CMake Error: No cmake script provided.
CMake Error: Problem processing arguments. Aborting.

EDIT

OK, so according to the advice below I run

cmake .. -DCMAKE_EXPORT_COMPILE_COMMANDS=ON

and now it generate compile_commands.json but I still cannot open it with KDevelope ... the Import Project dialog still shows everything gray and inactive (see screenshots below). Not sure if it matters that I run KDevelop under xubuntu 18.04 LTS (not Kubuntu) and Gnome-Flashback Desktop environment.

enter image description here enter image description here enter image description here


Solution

  • This should still work in KDevelop 5. There's no need to run cmake -DCMAKE_EXPORT_COMPILE_COMMANDS .., KDevelop will do it for you.

    The version of KDevelop packaged in Ubuntu 18.04 is rather old and has many known bugs, please try the 5.4.2 AppImage and see if that resolves your problem.