Recent

Author Topic: Compile Defines for packages  (Read 841 times)

Grahame Grieve

  • Sr. Member
  • ****
  • Posts: 379
Compile Defines for packages
« on: March 09, 2024, 09:11:16 pm »
I have a large project where a lot of the interesting code is in packages for use between different applications. I'm trying to understand how project compile options affect the compilation of the code in the packages. Specifically, I'm trying to switch between debug and release. The options I set in the project (assertions, optimisation, debugging info) are simply not reliable (I've noted this before: https://forum.lazarus.freepascal.org/index.php/topic,63163.msg477955.html#msg477955)

I'm trying to work around this without having to go and set the options for each of 20+ packages when I change the mode, but I haven't found a way. How is this supposed to work?

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 12206
  • Debugger - SynEdit - and more
    • wiki
Re: Compile Defines for packages
« Reply #1 on: March 09, 2024, 09:16:15 pm »
You can do this via "Additions and Overrides" in the project.

There you can specify for which packages the options should apply. E.g. #project,MyCoolPackage or IIRC even * (does not include rtl, as rtl is prebuild).

It is however a bit cumbersome if you need it for many projects, and keep needing it for the same set of packages.

jamie

  • Hero Member
  • *****
  • Posts: 7605
Re: Compile Defines for packages
« Reply #2 on: March 09, 2024, 10:31:55 pm »
That reminds me and I've been meaning to ask but,  is there a built in tool in lazarus to simply take a test app of specific units and place them in a newly created package or add to one?

The only true wisdom is knowing you know nothing

Grahame Grieve

  • Sr. Member
  • ****
  • Posts: 379
Re: Compile Defines for packages
« Reply #3 on: March 10, 2024, 06:24:28 am »
> You can do this via "Additions and Overrides" in the project.

How to do that was quite obscure, but it's exactly what I wanted, thanks. I added a note to the build modes section of the wiki making the link so it's less obscure for people in the future

 

TinyPortal © 2005-2018