
Add a nice header with the name, description, and home page. Find an appropriate location in 3rdparty/CMakeLists.txt to declare the library. Add the URL/tarball file to the top of 3rdparty/CMakeLists.txt. It would ease life of all packagers in distribution if it can be replaced by CMake macro CMAKEINSTALLLIBDIR so it will expand correctly on distribution using /usr/lib64 for example. project('another-application' VERSION 0. The steps to add a new third-party dependency are: Add the version and SHA256 hash to Versions.cmake. Authors of this library don’t distribute binary. To be able to load 3D models with the pre-made project we need Assimp library. First step: using CMake Download sources.
Cmake install lib how to#
It was left on purpose - we will learn how to use CMake by building Assimp ourselves. Instead you should rely on relative paths (as done above) or the $ generator expression (in exceptional circumstances) to avoid making your installation script non-relocatable. In a number of CMakeLists.txt there's an hardcoded lib/cloudcompare. The one dependency that is missing is Assimp library (responsible for loading 3D models). INCLUDES DESTINATION "$/cmake/mb"ĬACHE STRING "Installation directory for CMake package files")įinally, you should never read or set CMAKE_INSTALL_PREFIX from within the CMakeLists.txt file. This should be all you need: include(GNUInstallDirs) In CMake 3.14+ these are used as the default destinations for install(TARGETS).
Cmake install lib install#
Just because you seem new to CMake, a couple words of advice re: install rules.įirst, avoid hard-coding destinations.
