Passing defines/symbols through to referenced projects

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Passing defines/symbols through to referenced projects

171 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by jdupre on Wed Nov 27 15:04:52 MST 2013
I have a project that references another project.  When I define a symbol in the main project's "Paths and Symbols" page (i.e something like "USE_ALTERNATE_CONFIG) the referenced project does not know that it has been defined.  Is there a way to set up a "global" symbol so that the referenced projects in the workspace will see it also?
0 Kudos
1 Reply

144 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by lpcxpresso-support on Thu Nov 28 01:51:50 MST 2013
Referenced projects have no real relationship to the project that references it, and so it is not possible to share settings between them.

Referenced projects just define a build order. During the build process, a Referenced project is built before the project that references it.

One way to share options would be as follows.
[list]
  [*]gcc allows options to be provided from a command file, using the @file syntax. (see below for documentation)
  [*]to share common options between projects, put the options into the command file and place it in a known place within your workspace.
  [*]modify each project to add this @file option in the Miscellaneous Flags
[/list]
e.g. put the following into ../my_options
-DCOMMON_ONE

and then add @../my_options into the Miscellaneous flags for each project that wishes to use the common options.

Note: You can use Build macros in the filename (${workspace_loc:my_project}) but not in the command file itself.


Docs for @file:
@file
    Read command-line options from file. The options read are inserted in place of the original @file option. If file does not exist, or cannot be read, then the option will be treated literally, and not removed.

    Options in file are separated by whitespace. A whitespace character may be included in an option by surrounding the entire option in either single or double quotes. Any character (including a backslash) may be included by prefixing the character to be included with a backslash. The file may itself contain additional @file options; any such options will be processed recursively.
0 Kudos