The contents of the file will be made available to the calling script of find_package(). We just need to provide the my_library-config.cmake file. Set(MY_LIBRARY_VERSION $ - matches this expression. Set(MY_LIBRARY_VERSION_MINOR 0 CACHE STRING "minor version" FORCE) Set(MY_LIBRARY_VERSION_MAJOR 1 CACHE STRING "major version" FORCE) such as this: > CMake Error at CMakeLists.txt:182 (findpackage): > Could not find module FindGLEW.cmake or a configuration file for > package > GLEW. # define library version (update: apparently you can also do it in project()!) Find.cmake file located within your project. Did you create mingw-w64-x8664.cmake yourself, or is it something MSYS2 ships You probably shouldnt have or use any libraries or compilers in /usr, but rather from /mingw64 or /ucrt64, depending on your desired compiler flavor.These work identically to the above from an end-user perspective, but which Find modules are available depends on the version of CMake you have installed. The root CMakeLists.txt can look as follows: cmake_minimum_required(VERSION 3.0) Command findpackage has two modes: Module mode and Config mode. For common packages (e.g., boost) CMake ships FindXXX.cmake files that search well-known paths and take care of this for you. This allows a seperation of CMakeâs config files and other, unrelated configuration macros etc. The configurations will be set in the file which will be preprocessed to config_impl.hpp and included by config.hpp. The root CMakeLists.txt defines configuration options and adds the subdirectories. The library, the examples and the tool each has their own CMakeLists.txt defining the target and related code in their subdirectory. It also comes with some examples, a tool and unit tests. So we have a library consisting of various header and source files. The setupįor the scope of the tutorial, letâs say we have a library that has the following CMake structure: - include/ Throughout this post, Iâll be assuming a 3.x CMake version and an already existing CMake project. In particular, the system will be able to handle multiple installed versions and multiple configurations. In this post, I will show you how to install your library so that it can be used easily by other projects. As of version 0.5 my memory library now provides support for system-wide installation and CMakeâs find_package().Ä«ecause Iâve spent hours of trial and error to come up with it, Iâll document it here.
0 Comments
Leave a Reply. |