eclipse cdt indexer and include path

547 views
Skip to first unread message

Emil Huseynli

unread,
Jan 28, 2016, 2:05:13 PM1/28/16
to cmake4eclipse user mailing list
Hello,

i'm using the plugin for a while and i would like to say i'm very pleased with it. The plugin does his job very well.

Recently I started working on a Qt based cmake project. Cmake has a good support for Qt and, as I expected, I was able to build my project using the plugin, but... I have to manually enter Qt include paths in project preferences to make Eclipse indexer happy.

Am i missing something here? Is it possible somehow enable auto discovery of third-party libraries header files? Maybe plugin is capable to parse cmake output regarding that?

Thanks in advance.


Martin Weber

unread,
Jan 28, 2016, 4:34:52 PM1/28/16
to cmake4ecl...@googlegroups.com
Am Donnerstag, 28. Januar 2016, 11:05:13 schrieb Emil Huseynli:
> Hello,
>
> i'm using the plugin for a while and i would like to say i'm very pleased
> with it. The plugin does his job very well.

I'm pleased to hear that.

> Recently I started working on a Qt based cmake project. Cmake has a good
> support for Qt and, as I expected, I was able to build my project using the
> plugin, but... I have to manually enter Qt include paths in project
> preferences to make Eclipse indexer happy.

The plugin has a parser for the build output. That parsers tries to detect
invocations of the C/C++ compiler, extract include directories and
preprocessor defines and feed them to the indexer.
It can be enabled in
Project Settings|C/C++ General|Preprocessor Include Paths...
on the Providers tab: CMake Build Output Parser.

Parsing the build output to feed the indexer works well on linux with make and
gcc. It cannot work if
- the build tool does not print the compiler commands (as with ninja),
- the cmake generator decides to pass compiler commands in a separate file (as
with make under windows),
- the compiler arguments are not POSIX compatible ('-D' for marocs, '-I' for
include dirs, command name 'cc') as with the microsoft compiler.

>
> Am i missing something here? Is it possible somehow enable auto discovery
> of third-party libraries header files? Maybe plugin is capable to parse
> cmake output regarding that?

Sorry, that won't help. The output of cmake, when generating the build
scripts, does not show any include paths and macros.

For an indexer of CDT (or any IDE) with preprocessor symbols and include
paths, it must know

1) the compiler built-ins
- easy to get on *nix, some OS standards dictate these
-- easier on linux with gcc; gcc is in $PATH and has an option to spit out the
builtins willingly
- OSX: I don't know
- hard on windows; no OS standards enforcing the location on headers, no
standard to get the built-in #defines.

2) the include paths of each 3rd-party library
- cmake does a fairly good job to find these
. cmake does not provide a way to tell IDEs of its findings.
-- there have been suggestion on the cmake-dev mailing list to improve the
situation: EXPORT_COMPILE_COMMANDS and the cmake server mode. My plugin could
be enhanced to parse the file produced with 'cmake -D EXPORT_COMPILE_COMMANDS
...', but EXPORT_COMPILE_COMMANDS is there since cmake 2.8.11. On RHEL7 you're
lost, it still comes with v 2.5.8!

But be assured, on the CTD-dev mailing list, the CDT lead voted for 'cmake
support in CDT 9, and it has to be good'.

>
> Thanks in advance.

Sorry, can*t help much here.

What OS/Compiler/cmake version do you use?

Martin

--
Cd wrttn wtht vwls s mch trsr.


Emil Huseynli

unread,
Jan 28, 2016, 5:23:35 PM1/28/16
to cmake4eclipse user mailing list

Thanks a lot for a quick response.
 
The plugin has a parser for the build output. That parsers tries to detect
invocations of the C/C++ compiler, extract include directories and
preprocessor defines and feed them to the indexer.
It can be enabled in
Project Settings|C/C++ General|Preprocessor Include Paths...
on the Providers tab: CMake Build Output Parser.


If i enable CMake Build Output Parser i get following exception when building a project:

java.lang.NullPointerException
    at java.util.regex.Pattern.quote(Pattern.java:1277)
    at de.marw.cmake.cdt.language.settings.providers.CmakeBuildOutputParser.startup(CmakeBuildOutputParser.java:190)
    at org.eclipse.cdt.managedbuilder.core.ManagedBuildManager.collectLanguageSettingsConsoleParsers(ManagedBuildManager.java:4726)
    at org.eclipse.cdt.managedbuilder.core.ExternalBuildRunner.invokeExternalBuild(ExternalBuildRunner.java:116)
    at org.eclipse.cdt.managedbuilder.core.ExternalBuildRunner.invokeBuild(ExternalBuildRunner.java:72)
    at org.eclipse.cdt.managedbuilder.internal.core.CommonBuilder.build(CommonBuilder.java:753)
    at org.eclipse.cdt.managedbuilder.internal.core.CommonBuilder.build(CommonBuilder.java:513)
    at org.eclipse.cdt.managedbuilder.internal.core.CommonBuilder.build(CommonBuilder.java:459)
    at org.eclipse.core.internal.events.BuildManager$2.run(BuildManager.java:734)
    at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)
    at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:205)
    at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:245)
    at org.eclipse.core.internal.events.BuildManager$1.run(BuildManager.java:300)
    at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)
    at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:303)
    at org.eclipse.core.internal.events.BuildManager.basicBuildLoop(BuildManager.java:359)
    at org.eclipse.core.internal.events.BuildManager.build(BuildManager.java:382)
    at org.eclipse.core.internal.resources.Workspace.buildInternal(Workspace.java:486)
    at org.eclipse.core.internal.resources.Workspace.build(Workspace.java:405)
    at org.eclipse.ui.actions.BuildAction$1.runInWorkspace(BuildAction.java:287)
    at org.eclipse.core.internal.resources.InternalWorkspaceJob.run(InternalWorkspaceJob.java:39)
    at org.eclipse.core.internal.jobs.Worker.run(Worker.java:55)
 

But be assured, on the CTD-dev mailing list, the CDT lead voted for 'cmake
support in CDT 9, and it has to be good'.

Is that cmake support something different or based on your plugin?


What OS/Compiler/cmake version do you use?


Arch Linux 4.2.5
GCC 5.3.0
Eclipse Mars.1 Release (4.5.1) Build id: 20150924-1200
cmake version 3.4.1

15 knots

unread,
Jan 29, 2016, 5:51:08 AM1/29/16
to cmake4eclipse user mailing list
Please file an Issue for the NPE. Do not forget to attach the build output.


The planned support in CDT will be completely different.
My plugin is mainly targeted to generating the build scripts.
> --
> You received this message because you are subscribed to the Google Groups
> "cmake4eclipse user mailing list" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to cmake4eclipse-u...@googlegroups.com.
> Visit this group at https://groups.google.com/group/cmake4eclipse-users.
> For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages