![]() If the find_package module has created a cmake target for the library (using add_library(. How can I avoid bloating up the entire CMakeLists.txt file and the binaries, and still use the precompiled library? The included library requires for example Boost, but the core project not. Except *include_directories are also used for specifying the include directory of the project's own header files, not only those of the libraries. I know it has something to do with header-only libraries and so on,Īll of these have to do with libraries in general. Library targets can be used as items in link_libraries, and their dependencies are transitive by default. The purpose of the module is to generate cmake variables or targets that can be used to include the corresponding dependency.Īdd_library is similar to add_executable, except it adds a target for a library, rather rather than an executable. From a lower level point of view, find_package(Foo) looks for a cmake module FindFoo.cmake and executes the module. If you want to link with a library without including the source of the library in a sub directory of your project, then you use find_package. pretty much always).įind_package is used to search for cmake settings from external sources i.e. The target_* versions should be used whenever possible (i.e. The non-target versions apply to all targets in the directory. ![]() The target_* versions apply only to the target that is given as an operand. If the linked item is a cmake target, with specified include directories, they don't need to be specified separately with *include_directories. *link_libraries is used to supply a list of libraries (object archives) to the linker. When a file is included using the pre-processor, these directories will be searched for the file. *include_directories is used to supply a list of include directories to the compiler. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |