Skip to content

Excluding sources from the active build configuration

Felipe Torrezan edited this page Aug 28, 2023 · 1 revision

Consider the following project:

┏ πŸ“‚ Project
┃ ┣ πŸ“‚ 3rd-party-components
┃ ┃ ┣ πŸ“‚ array
┃ ┃ ┣ πŸ“‚ buffer
┃ ┃ ┃ ┣ πŸ“„ buffer_typeA.c
┃ ┃ ┃ ┣ πŸ“„ buffer_typeB.c
┃ ┃ ┃ β”— πŸ“„ buffer_typeC.c
┃ ┃ β”— πŸ“„ ring.c
┃ ┣ πŸ“‚ debug
...

For this fictitious example, the buffer component is supplied with 3 different implementations (buffer_type?.c) with different trade-offs whereas only one should be chosen at a time.

Let's say that you decide that the project needs buffer_typeA.c. Being so, buffer_typeB.c and buffer_typeC.c must be excluded from the current build configuration.

There are at least a couple of ways of accomplish this in the Workspace window:

  • Remove the undesired files from the project layout:

    • Highlight each of the undesired file nodes (buffer_typeB.c and buffer_typeC.c).
    • Remove them from the project layout by pressing the DEL key. or...
  • Exclude the undesired files from the build:

    • For each of the undesired file nodes: right-click and select: Options β†’ Exclude from build. or...
  • Create an "excluded" group:

    • Create a new group (i.e. excluded) inside the desired group.
    • Right-click on the excluded group and select: Options β†’ Exclude from build.
    • While holding SHIFT, select multiple files (i.e. click on buffer_typeB.c followed by buffer_typeC.c).
    • Finally drag the selection and drop these files inside the excluded group. By consequence, they will be excluded from the current build configuration (the example depicts "Debug").

project-exclude-group

⚠️ Notice that when a group or a file is excluded from build, its icon becomes grayed.

⚠️ Excluding sources from the current build configuration does not propagate to other build configurations.

πŸ’‘ Once the layout was customized, save the project by choosing File β†’ Save All. Alternatively, click the Save All icon in the Main toolbar.

ide-save-all