Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[cdt-dev] Retrieving project library paths from within a plugin fails

Hey,

I've asked on the newsgroups and got no answer so far.
Scanning the bug reports gave me no hint either.

I'm working on a CDT plugin that collects project information (includes,
sources, libraries) and writes that to the makefile structure for our
standard make projects. The reason for this is that we depend on
existing makefiles for now.

The idea is that the user sets the libraries (not only paths) in
'Properties/C/C++ General/Paths and Symbols/Library Paths' and
those entries are then written to the makefile. When I try to do
it similar to what I do with the includes (which works fine)
then it never returns any entries:

    ICProject project = ...
    ILibraryReference[] libraries = project.getLibraryReferences();
    // here libraries is always empty

I also tried a different approach found at

   http://cdt-devel-faq.wikidot.com/#toc22

which does it like:

    ICProjectDescription projectDescription =
    CoreModel.getDefault().getProjectDescription(project.getProject());

    ICConfigurationDescription activeConfiguration =
        projectDescription.getActiveConfiguration();

    ICFolderDescription folderDescription =
        ActiveConfiguration.getRootFolderDescription();

    ICLanguageSetting[] languageSettings =
        folderDescription.getLanguageSettings();

    ICLanguageSetting lang = null;

    for (ICLanguageSetting setting : languageSettings) {
        System.out.println(setting.getLanguageId());

        if (setting.getLanguageId() != null) {
            if (setting.getLanguageId()
                .equalsIgnoreCase("org.eclipse.cdt.core.g++") ) {
                    ICLanguageSettingEntry[] libraryPathSettings =
                 setting.getSettingEntries(ICSettingEntry.LIBRARY_PATH);

                 System.out.println("Count: " +
                                   libraryPathSettings.length);
                                   // Always zero aswell

                break;
            }
        }
    }

but it also returns no library entries.

I am using Eclipse CDT 5.0.0.200806171202 (same build id).

Is the entry under 'Properties/C/C++ General/Paths and Symbols/Library
Paths' just a dummy that is not available in standard make projects,
or does anybody know what I did wrong?

Thank you for any help!

Helmut


Back to the top