AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |
Back to Blog
Cmake find package1/31/2024 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) It expects that the following variables are set using -D: NAME: name of the package. Set(MY_LIBRARY_VERSION_MAJOR 1 CACHE STRING "major version" FORCE) This file is executed by cmake when invoked with -find-package. # define library version (update: apparently you can also do it in project()!) Those screenshots show that you did not clear your build directory first, so it was just using the same location if found before instead of the new location you specified (see my previous comment: make sure you remove any previous build the first time you do this or it will continue to use the system Qt it found previously). ![]() The root CMakeLists.txt can look as follows: cmake_minimum_required(VERSION 3.0) 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. While simple, this may lead to unpredictable builds, as. The usual way to add libraries in CMake projects is to call findpackage() and to link against libraries defined in a LIBRARIES variable.![]() In particular, the system will be able to handle multiple installed versions and multiple configurations. Additionally, the option CPMUSELOCALPACKAGES will enable findpackage for all CPM dependencies. 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
Read More
Leave a Reply. |