Open GrqPnegre opened 1 year ago
Hi @GrqPnegre
For CMake projects, CMAKE_EXPORT_COMPILE_COMMANDS
can also be defined as an environment variable (CMake docs). You could define it in a profile as a [buildenv]
(docs here) and that should work when cmake is invoke when building recipes, without modifying the recipe files.
As for bear
, this could be more challenging. Does bear make ...
only output the compile_commands.json
, or does it also transparently proceed with the build? If bear is only used with make, perhaps an option would be to have a script called make
that calls bear and the "real" make, but this could be fragile depending on how make is installed.
Thx @jcar87.
Using [buildenv]
is promising. I noticed that cmake
writes compile_commands.json
to CMAKE_BINARY_DIR
. Unfortunately, I needed to make changes to CMakeLists.txt
to install compile_commands.json
to the root of the package dir.
For your bear
comment, I'd need to play with that a bit and see what's lurking.
Newbie here... What are some suggested workflows for generating compile_commands.json (a la
clangd
) for conan projects? For make-based projects I typically build thusbear make ...
., whereas for cmake-based projects thuscmake -DCMAKE_EXPORT_COMPILE_COMMANDS=1 ...
. I'd really like to do this for any deps I'm pulling in, while avoiding mucking-up recipes files.