CMAKE_EXPORT_COMPILE_COMMANDS, compile_commands.json content

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

CMAKE_EXPORT_COMPILE_COMMANDS, compile_commands.json content

Martin Weber-2
Hi all,

in the generated compile_commands.json, what are the quoting rules in the
command fields?
Apart from the fact that a quotation mark in json inside a value has to be
escaped as *\"*, do the arguments in the command-field follow the shell-
escape rules or do they reflect the arguments passed to exec(1).

Seeing a line in my compile_commands.json starting with

"command": "/usr/bin/c++ -Dprojectname_ROOT_DIR=\\\"/home/username/workspace/
projectname\\\"

is confusing. What exactly is the value of macro projectname_ROOT_DIR here? A
string literal?

OTOH, the same line has

-DvtkFiltersFlowPaths_AUTOINIT=\"1(vtkFiltersParallelFlowPaths)\"

which I do recognize as a macro value of string literal type.

Background: My tool tries to get the macro definition from the  
compile_commands.json file [1]

TIA,
        Martin

[1] https://github.com/15knots/cmake4eclipse/issues/74

--
Cd wrttn wtht vwls s mch trsr.


--

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:
https://cmake.org/mailman/listinfo/cmake