Can I use the executables section in .adef to create distinct executable names?

Hi,

I defined some Environment Variables in the C/C++ Build tab of my DS 5.3.1 Project Properties window.
For example:
ENVIRONMENT_VAR_HW_BOARD = “mangoh_green”
LEGATO_TARGET=wp76
or
ENVIRONMENT_VAR_HW_BOARD = “company_board”
LEGATO_TARGET=wp8548

I would like to have different executable names for my builds, depending on the used values of my environment variables.

Can I do something like below in my .adef file?

executables:
{
_ MyApplication_${ENVIRONMENT_VAR_HW_BOARD}${LEGATO_ROOT} = (MyAppComponent)
}

This would result for instance in the executable name “Myapplication_mangoh_green_wp76”.

Greetings,
annaertd

Hi @annaertd

you certainly can use variables to have some dynamic behavior in your Xdef files. Variables are contributed either from the environment, or from an sdef buildVars section.
You just need to have something like:

executables:
{
    MyApplication_${ENVIRONMENT_VAR_HW_BOARD}_${LEGATO_TARGET} = (MyAppComponent)
}

But please make sure that the executable name is updated accordingly in all the other sections (process, bindings)

Hi @daav,

I understand your explanation, but, I can’t find the exact syntax to concatenate the environment variable to the name of my application.
The compiler complains about the $ symbol.
I already tried some other tricks and other character symbols, but, nothing compiles.
I didn’t find any examples in the documentation.

Can you help me out, please?

Greetings,
annaertd

Hi @annaertd

My bad, I though it was supported but apparently not.
Checking internally if there is a reason why.

Currently environment variables are only allowed in command-line arguments and file paths. I don’t know why this decision was made initially. If I remember correctly we have an open feature request to allow variables in all values, but it hasn’t been implemented yet.