FULL CODE LINK: https://github.com/dillonhuff/cmtest
Most examples of how to use CMake either show how to build a shared library and then use those shared libraries in the same project, or just show how to build executables for a project.
I had a hard time finding a clear example of how to build a shared library, install it (in my case in /usr/local/) and then use the installed library in a new project, so I decided to create one myself.
The code link above is a git repo with 3 directories:
- simple: a tiny example library with one function, that is built and installed using CMake
- user_project: a tiny "application" that links to simple along with the compile command I used on mac (OS X 10.11.3)
- cmake_user_project: another "application" that links to the simple_lib library. It is built with CMake instead of a simple compile command