[Lazarus] Failure to recompile with a different define

Mattias Gaertner nc-gaertnma at netcologne.de
Thu Sep 1 13:12:56 CEST 2016


On Thu, 1 Sep 2016 12:53:57 +0200
Giuliano Colla <giuliano.colla at fastwebnet.it> wrote:

> I have two Lazarus projects, let's call them project A and project B, 
> which share the same sources, only with a different define: let's say 
> -dProjA and -dProjB.
> 
> If, starting from a clean situation, I compile first project A, and then 
> project B, most of the modules aren't recompiled, and I end up with a 
> project B built with a mix-up of units, some compiled with project A 
> define and some compiled with project B define.
> 
> I managed to find a way out: setting different unit paths for project A 
> and project B solves the issue, but this situation may be rather 
> confusing for an inexperienced user.
> 
> IMHO this is not a very unusual setup: it applies to any situation where 
> the same base project must provide different options or features.
> 
> Is this a Lazarus issue or rather an fpc issue? Do ppu's include the 
> defines used for compilation? If not, wouldn't it be advisable to add 
> them somehow?

ppus do not include the defines, so a simple compile won't rebuild ppu
files. That's by design.

How do you share units?
If you do it manually by adding unit paths to the Compiler Options then
you have to clean up manually.
If you use Lazarus packages, then Lazarus will detect the changes and
pass the -B automatically.

Mattias


More information about the Lazarus mailing list