On Sat, Mar 21, 2015 at 9:41 AM, Stephen Kelly <steve...@gmail.com> wrote:
> Anton Makeev wrote:
>
>> The other thing that seems troubling to me is that since file, target,
>> language compiler options are split into different parts of metadata, the
>> IDE need to know exactly how to assemble them back into the compiler’s
>> command line (e.g. what flags go first file’s or language’s), duplicating
>> CMake's logic that may be different from version to version and from
>> compiler to compiler. The exact command line is needed to get the actual
>> and precise defines, include search paths etc. from the compiler.
>
> Yes. I previously proposed the <lang>_compile_command to contain information
> about how to built it:
>
>  
> http://www.steveire.com/cmake-future/manual/cmake-metadata-generation.7.html#optional-properties
>
> However, I think it might be better to generate something similar to what is
> currently generated in compile-commands.json into cmake-metadata.json. That
> is, we would generate (in some context)
>
>  "include_directories" : ["/foo", "/opt"]
>  "compile_definitions" : ["DEF=\"Foo\"", "OTHER_DEF=1"]
>  "compile_command": "-c -DDEF=\"Foo\" -DOTHER_DEF=1 -I/foo -I/opt"
>
> So, "compile_command" contains approximately what you can currently get from
> compile-commands.json.
>
> The other properties contain things which are specifically known to be
> include directories or compile definitions, as javascript arrays. These
> properties are obviously redundant information, so I wonder if they should
> be generated at all? Is the compile command I wrote above easy to parse? Or
> is it sufficiently difficult to parse that this redundant information should
> be provided?


How about include_directories, compile_definitions and compile_flags?

So something along the lines of:

"include_directories" : ["/foo", "/opt"]
"compile_definitions" : ["DEF=\"Foo\"", "OTHER_DEF=1"]
"compile_flags": [ "-c" ]

Parsing things is always error prone. Is that -D for definitions or /D?

The compiler flags are definitely needed though. They are used to e.g.
decide which dialect of a language are used.

This would keep parsing simple and will also provide all the
information we need.

"linker_flags" might also be interesting...

Best Regards,
Tobias
-- 

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