As such, I can include src files in main by #include as apposed to #include "src/file.h" I would like to be able to do the same for my headers that exist within the subdirectories of src.ĬMakeLists.txt cmake_minimum_required(VERSION 3. first its important to recognize that static libraries do. ParentDirĪs it currently stands, I have a library defined by the CMakeLists in the src directory. Solved-CMake: include library dependencies in a static library-C++. For example, if we had used Boosts datetime library in our header files for the Fitting target, we would add Boost::datetime as a PUBLIC dependency of our. As such, this is a brief synopsis of my project structure. Avoid this naming convention when creating variables for your projects. Many of these variables start with CMAKE. Add it to the CMAKEPREFIXPATH when you call CMake, then CMake will look for your library in the passed paths, too. CMake has some special variables that are either created behind the scenes or have meaning to CMake when set by project code. You already know the location of your library. It checks the usual places like /usr/lib, /usr/lib64 and the paths in PATH. In attempt to be brief and speak in higher level ideas of what and how, I have removed everything that I consider to be unnecessary details. findlibrary(FOOLIB foo) CMake will figure out itself how the actual file name is. items2.) Specifies include directories to use when compiling a given target. targetincludedirectories ( SYSTEM AFTERBEFORE items1. I mean, findlibrary is looking for pattern like /lib/lib. Hes right, though - if your project is using Qt at all (not clear from your post), then the pthread library is likely already being pulled in as a dependency.Using CMake, how can I include subdirectories into a library such that they can be included without referencing the directories they reside? Documentation targetincludedirectories Add include directories to a target.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |