Ceedling icon indicating copy to clipboard operation
Ceedling copied to clipboard

Set position of compiler flags

Open ErdlingProductions opened this issue 6 months ago • 2 comments

Hello!

I had the following issue, which I was not able to resolve elegantly.

For a mock, I needed to link lssl and lcrypto. I tried adding these compiler flags to the :flags section, but that did not quite work. For a successful compilation, these flags need to be given at the end of the command, something like this: gcc {in} -i {out} -lssl -lcrypto. When using the :flags section, those flags will always be placed directly after gcc, which leads to a failed compilation.

My workaround was to manually set up the linker under the :tools section, where I could place the crpyto flags last, which then compiled successfully.

I'd prefer using the :flags section, as I would not have to mess with the default linker settings, which for me are not immediately clear. It would also make the project setup simpler.

Am I missing an option or is this currently not possible?

Thanks and best regards!

ErdlingProductions avatar Jul 22 '25 06:07 ErdlingProductions

I think there is option :libraries: for that. Hope that helps you with seqrch

Letme avatar Jul 22 '25 08:07 Letme

Urgh so easy, sorry! And thanks!

It works:

:libraries:
  :placement: :end
  :flag: "-l${1}"
  :path_flag: "-L ${1}"
  :system: []    # for example, you might list 'm' to grab the math library
  :test:
    - ssl
    - crypto
  :release: []

The only downside is, that this does not work on a per file basis. But that is not that bad.

ErdlingProductions avatar Jul 22 '25 08:07 ErdlingProductions