Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
AW: [cdt-dev] check for Cygwin toolchain under CDT 4.0

Thanks, Mikhail!

It works! I did it this way:

------
private static boolean isCygwin(IProject project)
{
  boolean found = false;
  IManagedBuildInfo info = ManagedBuildManager.getBuildInfo(project);
  IConfiguration config = info.getSelectedConfiguration();
  
  if(config == null)
    config = info.getDefaultConfiguration();
  
  if(config != null)
    for(IToolChain tc = config.getToolChain(); tc != null && !found; tc = tc.getSuperClass())
      found = "cdt.managedbuild.toolchain.gnu.cygwin.base".equals(tc.getId());
  
  return found;
}
------

Is my understanding correct, that it is not possible to get this information directly from attributes from the "ICProject", i.e. without the help from the ManagedBuildManager?

Nils


-----Ursprüngliche Nachricht-----
Von: cdt-dev-bounces@xxxxxxxxxxx [mailto:cdt-dev-bounces@xxxxxxxxxxx] Im Auftrag von Sennikovsky, Mikhail
Gesendet: Freitag, 11. Mai 2007 11:18
An: CDT General developers list.
Betreff: RE: [cdt-dev] check for Cygwin toolchain under CDT 4.0

Hi Nils,

All cygwin tool-chain definition in the 4.0 are based upon the toolchain
of id "cdt.managedbuild.toolchain.gnu.cygwin.base", so to check whether
the tool-chain is a cygwin one you can check whether one of its
superclasses has this ID

Mikhail

-----Original Message-----
From: cdt-dev-bounces@xxxxxxxxxxx [mailto:cdt-dev-bounces@xxxxxxxxxxx]
On Behalf Of Hagge, Nils
Sent: Friday, May 11, 2007 1:00 PM
To: cdt-dev@xxxxxxxxxxx
Subject: [cdt-dev] check for Cygwin toolchain under CDT 4.0

Hello! 

In order to find out, if the build is based on the cygwin toolchain, I
use the following code snippet:

-----
IProject project =
ResourcesPlugin.getWorkspace().getRoot().getProject(projectName);

org.eclipse.cdt.managedbuilder.core.IManagedBuildInfo mbi =
 
org.eclipse.cdt.managedbuilder.core.ManagedBuildManager.getBuildInfo(pro
ject);

String s = mbi.getManagedProject().getBaseId();
boolean isCygwin = s.contains("cygwin");
-----

Is there a better way to do that under CDT 4.0.0?

Regards,
Nils


Back to the top