Skip to content

Inappropriate order of build command line options defined by csolution/cproject.yml and cdefault.yml #423

@chentang16

Description

@chentang16

Is there an existing issue for this?

  • I have searched the existing issues

Current Behavior

Build command line options, such as compiler, linker options can be defined in cdefault.yml or directly defined in csolution.yml or cproject.yml file. Now, if the same command line options, but different option values are defined in both cdefault.yml and csolution/cproject.yml, the command line options defined in cdefault.yml will be appended after the ones defined in csolution/cproject.yml, e.g. -gdwarf5 compiler options in my csolution.yml and -gdwarf4 in my cdefault.yml, as shown in the attached screenshot, -gdwarf4 from my cdefault.yml is appended after -gdwarf5 from my csolution.yml

Image

If the same option is specified multiple times, for toolchains like Arm Compiler 6, Arm LLVM Clang or GNU the last occurrence of the option takes precedence. Thus, as the example above, -gdwarf5 defined in csolution.yml will not take effect.

Expected Behavior

I assume as a general project setup, cdefault.yml can be defined and used for a project as the "baseline" or "default" options that are fit for the most use case of the project. And individual option tweaks might be necessary for individual csolution/cproject setups that users want to define to "overwrite" the default options.
Thus, it is worth considering changing the order to make the command line options defined in csolution/cproject.yml be appended after the ones defined in cdefault.yml.

Steps To Reproduce

  1. define -gdwarf4 in cdefault.yml
  2. cdefault: is used in csolution.yml
  3. define -gdwarf5 in csolution.yml
  4. check the generated compile_commands.json

Affected tools

  • cbridge
  • cbuild
  • cbuild2cmake
  • cpackget
  • csolution
  • packchk
  • svdconv
  • vidx2pidx

Affected operating systems

  • all
  • Windows amd64
  • Windows arm64
  • Linux amd64
  • Linux arm64
  • MacOS amd64
  • MacOS arm64

Environment

No response

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

Projects

Status

Backlog

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions