Do you want to change compiler flags that NetBeans IDE use by default for compiling C/C++ files?
Do you want to add compiler that is not supported by the NetBeans IDE? This article can help you to do this!
This tutorial demonstrates how to edit existing tool collections or create a custom tool collection
in NetBeans IDE 6.5.
Tool Collections
A tool collection is a set of compilers, make utility, and debugger. Every
time you compile, make, or debug your code, the
NetBeans IDE runs an executable file described in the tool collection descriptor.
Code Assistance features use include paths and macros taken from the tool collection.
The tool collection descriptor is an xml file located in the module
${NB}/cnd2/modules/org-netbeans-modules-cnd.jar.
in the folder org/netbeans/modules/cnd/resources/toolchain/.
Editing Tool Collection Descriptors
Editing a tool collection descriptor is a bit tricky since the NetBeans IDE
does not provide a GUI for editing descriptors.
Add the following flag in the file ${NB}/etc/netbeans.conf:
-J-Dcnd.toolchain.personality.create_shadow=true
Start the IDE, choose Tools > Options, and select C/C++ in the top pane of
the Options window. The IDE creates tool collection descriptors in your user
directory:
${userdir}/config/Services/CndToolChain/
You can edit a descriptor and the IDE will use it after you
restart.
Remove the flag before you start IDE next time. It needs only once to
create a shadow of bundled descriptors.
Creating a Custom Tool Collection
You can create your own tool collection. The following example creates a new
NetBeans module that contains new tool collection.
Create a new NetBeans module by choosing File > New Project.
On the Choose Project page of the New Project wizard, select the category
NetBeans Modules and the project Module at first step of the wizard.
Click Next. Type the project name, for example mytoolchain and click Next.
On the Name and Location page, type the code name base, for example
org.myhome.mytoolchain, and select the check box Generate XML Layer. Click
Finish. The IDE creates a new project.
Find the file layer.xml in the Projects window. Double clicking on
the file opens the file in the editor.
Copy and paste the following text inside the filesystem tag: