Well, my impression was that it is generally for external tools to be aware of 
the build process, or the commands CMake executes.

compile_commands.json is how Microsofts C++ extension to Visual Studio Code 
fetches compiler definitions and include directories. See last paragraph of:

https://github.com/Microsoft/vscode-cpptools/blob/master/Documentation/Getting%20started.md

The most feature complete LaTeX extension for VS Code is James Yus LaTeX 
Workshop

https://marketplace.visualstudio.com/items?itemName=James-Yu.latex-workshop

If I have a multi-language project (where CMake shines) that is end-to-end 
automated, such as the example found here:

https://github.com/Wigner-GPU-Lab/Teaching/tree/master/KutInf

(don’t heed git commit messages, Latex does work) which does:

1. Compiles a library
2. Compiles an executable that links to it
3. Runs the exe to get data
4. Invokes GnuPlot to create a diagram
5. Invokes LaTeX to create a doc with the diagram in it

The nice thing about it is, that if someone decides they need to alter the 
library, or just the exe, or just rename the plot axis… dependencies are 
tracked by CMake and building the doc target gets the job done with minimal 
effort. The C++ part of this works fine in VS Code, but I would like to make 
the LaTeX Workshop extension also aware of an external build system, much as 
how cpptools can be made aware of external magic.

In the end, I would like to be able to all the featues of LaTeX Workshop 
(linting, two-way navigation between resulting PDF & source .tex files (aka. 
SyncTeX), being able to display the result PDFs…) without having to do much 
more, other than authoring a decent CMakeLists.txt file and telling the 
extension where compile_commands.json is, much like as is the case with 
cpptools.


It is nice to have prime time support for Clang-tidy inside CMake, but hiding 
everything in the internals of CMake doesn’t help much with the tooling. Hope 
my use case was made clear enough.


Cheers,
Máté

Feladó: Brad King
Elküldve: 2017. november 21., kedd 16:00
Címzett: cmake-developers@cmake.org
Tárgy: Re: [cmake-developers] custom_command and compile_commands.json

On 11/21/2017 05:31 AM, Máté Ferenc Nagy-Egri via cmake-developers wrote:
> can we export custom commands into compile_commands.json?

The purpose of that file is to make compile commands available to
tools like clang-tidy.  Custom commands do not belong in it.
Its purpose has been largely superseded by first-class support
for running such tools along with the compiler, e.g.

https://cmake.org/cmake/help/v3.10/prop_tgt/LANG_CLANG_TIDY.html

It is also not produced by all generators.

> have the relevant Visual Studio Code extensions hook into
> ... LaTeX-Workshop extensino is not.

Please explain this use case.

-Brad
-- 

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more 
information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/cmake-developers

-- 

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more 
information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/cmake-developers

Reply via email to