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 cSettings
and 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
.pc
file for OpenLDAP in thePackage.swift
file and use this file w/ thepkgConfig
argument of the.systemLibrary
function? - Is it possible to give an absolute path to the
pkgConfig
argument? - If found, is the
.pc
file always preferred over the system libs?
Thank you for the help