My question is probably redundant, but all I found on the subject were old posts.
I’m trying to use OpenLDAP in a Swift project of mine. To do this, I create a system library:
.systemLibrary(name: "COpenLDAP", providers: [.apt(["libldap2-dev"]), .brew(["openldap"])])
Everything is good on Linux. On macOS however, all function calls to the LDAP lib are marked deprecated. To fix this, I want to force the Swift compiler to use Homebrew’s installation of OpenLDAP instead of the system one. And this is where it starts to get fun.
OpenLDAP does not have a
pkg-config file. So we cannot simple set the
PKG_CONFIG_PATH variable! We have to set the
-Xcc -I… -Xlinker -L options.
However, weirdly enough, the
linkerSettings arguments I can set for a “regular” target do not seem to be available for system library targets.
- Why is that? Is there something that can natively be done to force the search path of the headers and libs for a system library target?
- Am I correct in assuming I could theoretically autogenerate a
.pcfile for OpenLDAP in the
Package.swiftfile and use this file w/ the
pkgConfigargument of the
- Is it possible to give an absolute path to the
- If found, is the
.pcfile always preferred over the system libs?
Thank you for the help