Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [cdt-dev] How to get the type of C/C++ project (ex. Static Library) having ICProject?

> Hello! I can't get answer for this question about CDT Model.
>
> I'm developing plugin (actionSet) and I have ICProject of some project.  
> How can I check that it is Static Library?
> P.S. Static library may use standard GNU GCC Toolchain or my Toolchain.

Perhaps you can reuse the code shown below to get the IProjectType for
the project's active configuration. Another method might be to match
the config.getArtifactExtension() against the static library
extension (="a"?), not sure how foolproof that is.

public static IConfiguration getActiveConfiguration( IProject project )
{
    IManagedBuildInfo info = ManagedBuildManager.getBuildInfo(project);
    if ( info != null )
    {
        return info.getDefaultConfiguration();
    }
    return null;
}
public static IProjectType getProjectType( IProject project )
{
    IConfiguration config = getActiveConfiguration(project);
    if ( config != null )
    {
        while ( config.getParent() != null )
        {
            config = config.getParent();
        }
    }
    if ( config != null )
    {
        return config.getProjectType();
    }
    return null;
}


Back to the top