[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [cdt-dev] Question about C/C++ Project References

Hi Christian,

On 21 November 2011 20:40, Christian Damus <CDamus@xxxxxxx> wrote:
I am trying to decide whether project build-order dependencies in my CDT-based tooling are better implemented using the Eclipse Platform project references or the "References" tab in the "C/C++ General -> Paths and Symbols" properties of a project.

The important consideration is what the semantics of the CDT's project/configuration references are.  Apparently, the CDT-style reference ensures that the referenced configuration (which may be the dynamic active configuration) of the referenced project is up-to-date build-wise when building the referencing project configuration.  This is great.  The question, though, is what else does this reference imply?

Two sources suggest that a project actually *imports* build settings from referenced project configurations.  For example, the Javadoc on the ICConfigurationDescription::setReferenceInfo() API says this:

Sets the reference information for this configuration. This configuration will pick up settings exported by referenced configurations.

And in the .cproject file, the reference is manifest as a settings storage-module:

<storageModule moduleId="org.eclipse.cdt.core.externalSettings">
    <externalSettings containerId="OtherProject;config.debug.1150649823" factoryId="org.eclipse.cdt.core.cfg.export.settings.sipplier"/>

This all suggests that, for example, if the referenced project exports, say, source locations or library paths, my referencing project may start building sources from the referenced project or searching the wrong directories for libraries, which I don't want.  All that I want is to specify build-order dependencies on referenced configurations.

Is my understanding of the situation accurate?  What advice can you offer?

Your understanding is correct.  The main difference is that, until 3.7, the platform didn't support build configurations. So if you wanted a specific project configuration to be built before another, you would need to configure a CDT configuration level reference. 

CDT config references do also propagate exported settings.  So a given config can export a number of paths, and referencing configs can automatically pull in exported includes, defines and library paths from the referenced config.  The result is that dependent build information can be pushed out to referencing configs and users needn't manually enter them in each referencing project.  There's UI for this (which is hidden by default: Window > Preferences > C/C++ > Property Page Settings > Display "Export Settings" Tab)