How can I add a library path to a delphi project?

BIBD picture BIBD · Sep 1, 2015 · Viewed 10.1k times · Source

I have a couple precompiled (3rd party) libraries that I need to use in my project.

I can get it to build if I put foo.a in the root of my project folder, however, I have a 32 bit version and a 64 bit version of the library and I don't want to have to swap out foo.a with foo.32.a and foo.64.a every time I build each version of the application.

In this particular case I've put them in:

[myroot]\iOSDevice32\Debug\foo.a
[myroot]\iOSDevice32\Release\foo.a

and

[myroot]\iOSDevice64\Debug\foo.a
[myroot]\iOSDevice64\Release\foo.a

I could put it in the libary path (Tools -> Options -> Delphi Options -> Library -> Library Path); however, I want it to be specific to the project and relative to the root of the project folder (rather than hard coded to one location for all projects).

How can I tell Delphi/Embarcadero RAD Studio where to find these libraries?

Answer

Ken White picture Ken White · Sep 1, 2015

Put it in the project's search path (Project->Options->Delphi Compiler). You'll see a couple of examples there for using .\$(Platform)\$(Config), which is a relative path to the project based on the target platform and build configuration.