📅 2015-Aug-05 ⬩ ✍️ Ashwin Nanjappa ⬩ 🏷️ cmake, library, linker ⬩ 📚 Archive
For most common libraries, CMake has inbuilt modules which find and include them for compilation and linking. But, there are situations where you need to use library files (say *.so
) that are in a custom directory somewhere that need to be linked with the code you are building.
One or more of such paths which should be requested to search for library files while linking can be specified like this:
link_directories(
/home/joe/bellringer/lib64
/home/joe/globespin/libs
)
The library files in these directories can now be specified in link_libraries
or target_link_libraries
using the usual -l
syntax.
Reference: link_directories
Tried with: CMake 2.8.12.2 and Ubuntu 14.04