this may seems obvious for someone, but not for me.
How to use cmake on Mac? Let's say I have a project in Xcode and I want that project link with assimp library.
So I download assimp source, generate build with cmake, point Xcode to /include in downloaded source and what then? Where are built libraries? What I only have is Xcode project of that library. Does it generate libraries?
If I use brew to install assimp, I only set this in my Xcode project:
and I'm finished.
What are benefits of cmake for building libraries from source besides that source is "fresh" and I'm unable to do it right?
Could somebody post step-by-step what to do when building things with Cmake, with explanation?
Most importantly where does Cmake put libraries, and how to link with them?
CMake does not build the libraries, it "only" generates platform specific Makefiles (or equivalents). You still need to compile and install the compiled libraries and headers.
For the library you want to build the following steps are necessary (I am doing them on Linux, but this should be applicable to Mac OS X as well).
git clone https://github.com/assimp/assimp.git
cd assimp
mkdir build
cd build
cmake ..
The build
folder now contains a Makefile
, and when you run make
, the library will be compiled.
After this step, the freshly built library is located at build/code/libassimp.so
.
You could leave the library as well as the include files there and reference them when compiling/linking your project. Usually, you want to install
them, so they are available systemwide and can be found automatically.
This is done using sudo make install
.
The library should now be in /usr/local/lib
, the include files in /usr/local/include
. You can change these locations using CMake.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With