[Lazarus] Adding Required Packages paths... dynamically

Marcos Douglas B. Santos md at delfire.net
Fri Jul 19 05:26:49 CEST 2019


Imagine a package that has a dependency for another one. However, this
dependency has a conditional to exists. So, I cannot add the Required
Package by default — I'm talking about ZeosLib.

Then, I used Conditionals (script) for adding ZeosLib paths (-Fu, -Fi)
into the paths of the package — amazing work in IDE, by the way.

In Custom Options | Conditionals, I have something like this:
if undefined(NOSYNDBZEOS) then
  UnitPath += ';$PkgOutDir(zcore);$PkgOutDir(zdbc);$PkgOutDir(zparsesql);$PkgOutDir(zplain)';
  IncPath += ';$(ProjOutDir);$PkgDir(zcore)\..\..\src';

And it works. If user add the package into a project, he/she could
compile with/without support to ZeosLib, just checking/unchecking some
definition into Defines button. Excellent.

However, my only problem occur if user add zcomponent package, which
belongs to ZeosLib. If so, I get some hints like this:
Note: Duplicate unit "ZVariant" in "mormot_base 1.18", orphaned ppu
Note: Duplicate unit "ZVariant" in "zcore 7.2.5",
Note: Duplicate unit "ZVariables" in "mormot_base 1.18", orphaned ppu
Note: Duplicate unit "ZVariables" in "zcore 7.2.5",

What I don't understand is:
Adding ZeosLib into mormot_base package as a dependency (just for
testing), I have the same paths as using Conditionals. Then, why the
compiler show me these hints when I'm using ZeosLib paths
"dynamically" by Conditionals?
What should I do to remove them?

best regards,
Marcos Douglas

More information about the lazarus mailing list