Search code examples
eclipsearmeclipse-cdtds-5

How to efficiently manage file exclusion from build in Eclipse CDT?


I have an embedded C project comprised of dozens of source module and headers, in a directory hierarchy. The project is defined for a few targets (managed using build configurations) and many of the modules are included in the build for only a subset of configurations.

The project is a makefile project, built from command line, and I am using the Eclipse IDE mostly for its static code analysis capabilities. For example, when searching for a definition of an object, it knows what header file to open, based on the inclusion of that module in the build configuration.

In the past I used the Export/Import feature to bulk-edit the include paths and macro definitions for the various configurations.

But I am looking for a way to do that for module inclusion/exclusion. If I right-click on a directory in the code tree, I see the Exclude from build... menu entry, that opens a dialog with the list of configurations, where I can conveniently select in which configs to exclude that directory.

But, this dialog is missing from the context menu of a specific module. Thus, I need to open the Properties dialog and scroll through all configs exclude the from the required ones one-by-one.

Is there a dialog similar to the directory one for a single module?

Is there a way to export these settings (other than include paths and macros) to an XML file for easy editing? Where does Eclipse save this information?

I am using ARM's DS-5 Eclipse platform version Mars.2 (4.5.2)


Solution

  • I see Exclude from build... in the Resource Configurations submenu for both directories and individual files.

    As for where Eclipse stores this information: in the .cproject file, in entries that look something like this:

    <cproject ...>
      <storageModule ...>
        <cconfiguration ...>
          ...
          <storageModule ...>
            <configuration ...>
              ...
              <sourceEntries>
                <entry excluding="<path-to-excluded-resource>" ...>
                ...
              </sourceEntries> 
              ...