

Having defined all of the above CMake is able to find the required parts of a library except where to find the find.cmake file itself.
CMAKE LINUX NATIVE PACKAGE HOW TO
The details on how to use it is explained at the end of this article, but it looks something like this: list(APPEND CMAKE_MODULE_PATH "$ is the location of the library file provided by find_library. Could not find a package configuration file provided by 'Harfbuzz' with any of the following names: HarfbuzzConfig.cmake harfbuzz-config.cmake Add the installation prefix of 'Harfbuzz' to CMAKEPREFIXPATH or set 'HarfbuzzDIR' to a directory containing one of the above files. Once the library is found it can be linked to targets using target_link_libraries. The project structure looks something like this>

by using cmakes “fetchContent” mechanism]). dll file and header files are downloaded to a location inside the build folder (i.e.

Let’s assume we have a CMake project that depends on an non-CMake built dynamically shared library called LibImagePipeline. Set up targets for the imported packageįor the full documentation and inner workings head over to the official CMake documentation.Set up variables for include-path and library-path for the package.Look for files belonging to the package in likely locations.cmake files that provide information about where to find the headers and libraries of the other modules. In a nutshell, the mechanism often referred to as find.cmake, “find package” or “find modules” uses. This is essential if you want to shift your codebase to CMake without the need to migrate the whole ecosystem of a software portfolio at once. So what if you want to move your codebase to CMake without rewriting the way all these old dependencies are built?įortunately, CMake’s find_package allows you to mix a CMake project with artifacts built by some other build system. Unfortunately, you might be stuck with an existing piece of software that is built entirely differently - be it makefiles, gradle, Qmake or even a completely custom-built way to compile software - you name it. Over the last few years, CMake has become one of the most popular ways to build C++ applications and libraries. CMake is awesome, but it can be hard to figure out.
