Here’s how I have set up boost in Xcode 5:
- Build and install boost
- Set the search paths in Xcode
- Add the .dylib file to the project
- Make sure the project is linking with the .dylib file
- Create a copy phase to copy the .dylib to the appropriate place
1. Build and Install Boost
You can more or less follow the instructions on boost website. I chose to compile with clang and libc++ because, well, let’s face it, c++11 is kinda cool.
buddy$ cd boost_1_54_0
buddy$ ./bootstrap.sh --with-toolset=clang --prefix=/path/to/your/build/directory
buddy$ ./b2 install toolset=clang variant=debug debug-symbols=on cxxflags="-std=c++11 -stdlib=libc++" linkflags="-stdlib=libc++"
Also, note that I’m building the debug libraries, as this library will be used mostly for development. For release mode, you can change the variant to “release.”
2. Set the search paths in Xcode
Let’s assume that you have already set up an Xcode project.
To add boost headers and dylib files to your project’s search path, go to your project build settings:
And add /path/to/boost/include to “Header Search Paths” and /path/to/boost/lib to “Library Search Paths.”