How do I link libraries like openssl, sdl2, or Cairo in Xcode

Hi Everyone,

This is my first post here. I am a student looking for answers, and I would like to know how to use libraries such as the ones mentioned in the title. How do I link them? I have tried every method under the sun, but I cannot get Xcode to find the file I am trying to include.

It depends.

The best way to handle this is to have your open source build system — make, CMake, whatever — build an XCFramework that contains component frameworks for all the platforms that it supports. You can then add that to your project and everything proceeds smoothly from there.

Ideally the component frameworks would be mergeable, which allows you to choose whether you want to link to the code dynamically or statically.

Ideally the component frameworks would use an rpath-relative install name. That makes it much easier to link to the code dynamically.

I explain all of this terminology in An Apple Library Primer.

If you’re not in this ideal world then the best path forward depends on the library itself. It’s hard to offer generic guidance, other than that you should follow the instructions provided by the library’s support resources.

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

How do I link libraries like openssl, sdl2, or Cairo in Xcode
 
 
Q