Recent

Author Topic: Custom IDE macros (conditionals) in `execute before` command  (Read 435 times)

Khrys

  • Sr. Member
  • ****
  • Posts: 421
Custom IDE macros (conditionals) in `execute before` command
« on: October 14, 2025, 08:14:11 am »
I have a package that bundles a library written in C, which is built using a  make  command in  Package Options → Compiler Commands → Execute before.

I've also defined an IDE macro (e.g.  PACKAGENAME_DEBUG,  either  'On'  or  'Off')  that controls debugging & optimization flags via  Package Options → Custom Options → Conditionals  to allow fine-grained control over those options on a per-project basis.

The IDE macro works just fine for FPC flags  (CustomOptions),  but so far I haven't found a way to conditionally pass options to  make  (e.g.  make CFLAGS=$(CustomCFLAGS)  doesn't work).

Now my question is:  How can I pass a value from Package Options → Custom Options → Conditionals to a program executed before compilation?

Thaddy

  • Hero Member
  • *****
  • Posts: 19013
  • Glad to be alive.
Re: Custom IDE macros (conditionals) in `execute before` command
« Reply #1 on: October 14, 2025, 08:22:18 am »
Maybe you can use environment variables for that? (set on windows, export on linux)
It is just a guess, but I have done similar before, though not from within Lazarus.
Recovered from removal of tumor in tongue following tongue reconstruction with a part from my leg.

Khrys

  • Sr. Member
  • ****
  • Posts: 421
Re: Custom IDE macros (conditionals) in `execute before` command
« Reply #2 on: October 14, 2025, 08:35:49 am »
Yes, environment variables would also work (as opposed to command-line options). But the issue lies with conditionally defining them via the custom options script.
All I want is the ability to influence  CFLAGS  from a project's  Additions and Overrides  matrix (as opposed to having to modify the project file every time I need to debug a package within a project).

 

TinyPortal © 2005-2018