[CMake] custom_command and compile_commands.json

Moreland, Kenneth kmorel at sandia.gov
Mon Nov 6 12:28:22 EST 2017


Máté,

I don’t know anything about the CMAKE_EXPORT_COMPILE_COMMANDS feature, but I can attest that the UseLATEX commands are all created with add_custom_command (with some add_custom_target commands to set up the targets). Someone who knows the CMAKE_EXPORT_COMPILE_COMMANDS feature will have to answer whether it is possible to export custom commands.

-Ken

From: CMake [mailto:cmake-bounces at cmake.org] On Behalf Of Nagy-Egri Máté Ferenc via CMake
Sent: Sunday, November 5, 2017 11:07 AM
To: Cmake Mailing List <cmake at cmake.org>
Subject: [EXTERNAL] [CMake] custom_command and compile_commands.json

Hi!

I am trying to export a custom_command to the compile_commands.json database, but no luck up until now. The only similar question I found on the web is a Stackoverflow thread named „cmake clang-tidy (or other script) as custom target”.

I am trying to bring together C/C++ compilation, GnuPlot and LaTeX into a single Cmake script (done), and have the relevant Visual Studio Code extensions hook into the compile_commands.json file to recognize CMakes machinery and that they themselves are not responsible for kicking off the compilation of their respective source files. Microsofts C++ extension is compile_commands.json aware, but the LaTeX-Workshop extensino is not. I wanted to do the research before jumping to feature requests: is it possible to export @kmorel Github users UseLATEX custom_commands into the compile_commands.json database? As far as I saw, setting CMAKE_EXPORT_COMPILE_COMMANDS to ON right before add_latex_document() is not enough. Does LATEX need to be a first-class CMake language in order for this machinery to kick off?


Tanks in advance,
Máté
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/cmake/attachments/20171106/013ee70d/attachment.html>


More information about the CMake mailing list