[cmake-developers] FW: [CMake] custom_command and compile_commands.json

Máté Ferenc Nagy-Egri csiga.biga at aol.com
Tue Nov 14 04:19:59 EST 2017


This thread on the CMake users mailing list has been silent for the past week. I wanted to bring it over to the dev list, because there might be more expertise here on the subject at hand.

tl;dr: can custom_commands be exported into compile_commands.json? This is another projection of the problem: how to add new languages to CMake conveniently. If I need to make LaTeX a first-class language to make the export, it’s an awful lot of work only to make IDE extensions LaTeX aware (and I could go on with SYCL, GnuPlot, etc.).

Cheers,
Máté

Feladó: Moreland, Kenneth
Elküldve: 2017. november 6., hétfő 18:28
Címzett: Nagy-Egri Máté Ferenc
Másolatot kap: cmake at cmake.org
Tárgy: RE: [CMake] custom_command and compile_commands.json

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-developers/attachments/20171114/d1821a04/attachment.html>


More information about the cmake-developers mailing list