Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[cdt-dev] Add Library to current project clicking on menu/button

Dear All,

I want the functionality in which if I click on menu(button), a specific library should be added in my project. After that I can use the existing build option & run my project.
For this I have written following code. I just want to extract the current project & add the specific library "yes".


                              IManagedBuildInfo info = null;
                              try {
                                   info = ManagedBuildManager.getBuildInfo(proj);  // how do I get the current executing project here ?
                                 } catch (Exception e) {}
               
                             IManagedProject mProj = info.getManagedProject();
                                            
                             IConfiguration[] configs = mProj.getConfigurations();
               
                             for (int i = 0; i < configs.length; i++) {
                                   IConfiguration cf = configs[i];

                                  
                String[] valueList = null;
                String libName = "yes";
                String ext = "o";
                ITool cfTool = cf.getToolFromInputExtension(ext);
                String optLibsID = " gnu.c.link.option.libs";
                IOption option = cfTool.getOptionById(optLibsID);
                valueList = option.getLibraries();
                int len = valueList.length;
                String newList[] = new String[len + 1];
                System.arraycopy(valueList, 0, newList, 0, len);
                newList[len] = libName;
                //return newList;
                ManagedBuildManager.setOption(cf, cfTool, option, valueList);
                return null;




PLEASE HELP. I am stucked here since long. Truly requires help. I am just a beginner.

--
Thanks & Regards,
Sagar Zaveri

Back to the top