IMP logo
IMP Manual  for IMP version 2.13.0
uselibrary.md
1 Using the library in other projects {#uselibrary}
2 ===================================
3 
4 The %IMP C++ library can be used in other projects. When %IMP is built or
5 installed, it creates a [CMake](https://cmake.org/) file called
6 `IMPConfig.cmake` which contains information about how %IMP was configured
7 and where all the parts of %IMP can be found. This can be used to easily
8 add %IMP as a dependency to other C++ projects using CMake.
9 When built from source, this
10 file is placed in the CMake build directory; when installed, it is placed
11 under the library directory, for example in `/usr/lib64/cmake/IMP/`.
12 
13 The `IMPConfig.cmake` file defines a number of CMake variables:
14 
15 - `IMP_USE_FILE`: the path to a CMake file which can be
16  [included into other CMake scripts](https://cmake.org/cmake/help/v3.13/command/include.html)
17  to make %IMP-related CMake functions available.
18 - `IMP_INCLUDE_DIR`: the path containing %IMP C++ headers.
19 - `IMP_xxx_LIBRARY`: the full path to the dynamic library for the `xxx` module
20  (for example `IMP_kernel_LIBRARY` points to the IMP kernel and
21  `IMP_atom_LIBRARY` to the IMP::atom library).
22 - `RMF_INCLUDE_PATH`: the path containing RMF C++ headers.
23 - `IMP_DATA_DIR`: the path containing %IMP data files.
24 - `IMP_SWIG_DIR`: the path containing SWIG `.i` files for all %IMP modules.
25 
26 The paths to all %IMP dependent libraries and headers are also present in
27 this file - for example `EIGEN3_INCLUDE_DIR` and `Boost_INCLUDE_DIR`.
28 
29 A [FindIMP.cmake](https://github.com/salilab/pmi/blob/develop/tools/FindIMP.cmake)
30 file is provided to help CMake find this %IMP configuration (using the
31 [find_package](https://cmake.org/cmake/help/v3.13/command/find_package.html)
32 command), and can be used in other CMake projects.
33 
34 See also the tutorial on
35 [using IMP as a C++ library](https://integrativemodeling.org/tutorials/using_cpp/)
36 for a worked example of using %IMP in a CMake project.
37 
38 This functionality can also be used to build an %IMP module "out of tree",
39 that is to build the module by itself and link to an existing pre-built
40 %IMP installation. See the [out of tree](@ref outoftree) page for more
41 information.