I am trying to use codelite with an external project that uses cmake.
I have cmake configured to generate a compile_commands.json file, but can't figure out how to point codelite to the location of that file.
How do I specify the location of compile_commands.json?
-
- CodeLite Curious
- Posts: 2
- Joined: Sat Sep 27, 2014 9:06 pm
- Genuine User: Yes
- IDE Question: c++
- Contact:
- eranif
- CodeLite Plugin
- Posts: 6375
- Joined: Wed Feb 06, 2008 9:29 pm
- Genuine User: Yes
- IDE Question: C++
- Contact:
Re: How do I specify the location of compile_commands.json?
First, codelite searches for an updated compile_commands.json file after the build is over (does not matter if it succeeded or not).
So make sure:
- You have a workspace opened in codelite with all your sources
- Your workspace file (.workspace file) should be on the same directory as the top level CMakeLists.txt file
- Issue a build (I assume its a custom build project that simply invoke 'make' or something similar)
- When the build is done, codelite will pick the compile_commands.json file and will update its 'compilation.db' (located under workspace-path/.codelite/compilation.db)
To confirm that it worked, you can:
- Open the file workspace-path/.codelite/compilation.db (using the DbExplorer plugin and view its content, located under in the workspace view at the far right...)
- Increase codelite's logging from: settings->global editor preferences->misc->log, and change the verbosity to 'Debug', open the file '~/.codelite/codelite.log' or %appdata%\codelite\codelite.log
Last but not least:
Its your first post on the forum, so please make sure you have read the 'HOW TO POST' thread (check my signature) - you need to provide more information
To configure your workspace properly to use your CMake build, see here:
http://codelite.org/LiteEditor/CustomMakefiles#toc3
Eran
So make sure:
- You have a workspace opened in codelite with all your sources
- Your workspace file (.workspace file) should be on the same directory as the top level CMakeLists.txt file
- Issue a build (I assume its a custom build project that simply invoke 'make' or something similar)
- When the build is done, codelite will pick the compile_commands.json file and will update its 'compilation.db' (located under workspace-path/.codelite/compilation.db)
To confirm that it worked, you can:
- Open the file workspace-path/.codelite/compilation.db (using the DbExplorer plugin and view its content, located under in the workspace view at the far right...)
- Increase codelite's logging from: settings->global editor preferences->misc->log, and change the verbosity to 'Debug', open the file '~/.codelite/codelite.log' or %appdata%\codelite\codelite.log
Last but not least:
Its your first post on the forum, so please make sure you have read the 'HOW TO POST' thread (check my signature) - you need to provide more information
To configure your workspace properly to use your CMake build, see here:
http://codelite.org/LiteEditor/CustomMakefiles#toc3
Eran
Make sure you have read the HOW TO POST thread
-
- CodeLite Curious
- Posts: 2
- Joined: Sat Sep 27, 2014 9:06 pm
- Genuine User: Yes
- IDE Question: c++
- Contact:
Re: How do I specify the location of compile_commands.json?
Thanks for the fast response! My confusion came from thinking that I had to manually provide the path.
I normally build from a terminal outside of the IDE, but after I ran a build within codelite, it looks like codelite was able to find it.
I think that it would be good to be able to manually specify the location of the compilation database (with the default value set to the auto-detected location). In my project I have multiple compile_commands.json files for different build configurations, but would only want codelite to use one of them.
I normally build from a terminal outside of the IDE, but after I ran a build within codelite, it looks like codelite was able to find it.
I think that it would be good to be able to manually specify the location of the compilation database (with the default value set to the auto-detected location). In my project I have multiple compile_commands.json files for different build configurations, but would only want codelite to use one of them.