I'm trying to use some version of libpcre in a swift program for macOS, through Xcode 12.5. I can't seem to get the system to find the libraries I have tried.
Search on this topic on the web is maddening, because nothing really seems to be complete. I'd like to ask for 2 pathways:
Library which comes with Xcode/macOS
If I look at my target info panel in the project editor, I can add Frameworks and Libraries. I would like to add libpcre.
I hit the "+", scroll down and select libpcre.tbd
. It dutifully adds an entry.
How do I now use this in a swift file, and see the various functions from the pcre library?
Library installed from Homebrew
Say I have decided that pcre version 1 isn't enough, and I need to add libpcre2. I use "brew install pcre2", which installs the files in /usr/local/Cellar/pcre2/10.36/ .
How do I now show Xcode how to find these libraries, and use them in my swift file?
The Test
In both cases, my basic test is that I ought to be able to type
let recode = pcre<ESC>
and have Xcode show me the various symbols from the included library.