Closed sobkulir closed 12 months ago
@sobkulir
1) doens't work, but 2) does
The goal is to keep it consistent with the way CMake has implemented this, i.e. -DFOO=BAR
. The way it's implemented in fprime-tools is a little hacky, but it seems to be working fine for me.
I guess the --help flag "-Dxyz DXYZ" can be a little misleading. I'll take a look at how this can be fixed (not as trivial as it sounds since we are purposefully not matching the arguments). Unless someone wants to take a crack at it?
I see, thanks for the quick answer! Reading my issue again, I think I overcomplicated it a bit, but you got it right -- I agree that the best way to go about it would be:
1) Making "-Dxyz DXYZ"
in --help be "-D FOO=BAR"
2) Extending the regex to allow the extra space to be in line with the message in --help, i.e., r"-D\s?([a-zA-Z0-9_]+)=(.*)"
3) (optional) Allow, the type specifier in the regex, i.e., r"-D\s?([a-zA-Z0-9_]+(?::[A-Z]+)?)=(.*)"
and change the help message to "-D FOO[:TYPE]=BAR"
2)) was not possible due to argparse interpreting the space as specifying the platform argument. Implemented 1) and 3) in the above PR
Problem Description
Running
fprime-tools generate
should implement-Dxyz KEY=VAL
to pass flags to CMake, however, this functionality doesn't work as expected :Instead, it's implemented as
-DKEY=VAL
.How to Reproduce
1) doens't work, but 2) does:
Expected Behavior
Either 1) should work and 2) not, or 2) should be documented rather than 1).
Root cause
Relevant files: 1) https://github.com/sobkulir/fprime-tools/blob/devel/src/fprime/fbuild/cli.py#L212 2) https://github.com/sobkulir/fprime-tools/blob/devel/src/fprime/util/cli.py#L214
Extra
Also, the CMake flags are passed with syntax parameter to the regex.
-D <var>[:<type>]=<value>
, consider adding the