IMP logo
IMP Manual  for IMP version 2.6.1
cmake_config.md
1 CMake configuration options {#cmake_config}
2 ===========================
3 
4 [TOC]
5 
6 # Building with CMake {#cmake_building}
7 
8 We use [CMake](http://www.cmake.org) to configure the %IMP build when
9 [building from source](@ref installation_compilation).
10 
11 There are two different ways to configure with `cmake`; one is to run `cmake`
12 in a fresh directory passing some options on the command line, and the other
13 is to run `ccmake` and use its editor to change options. For both, assume you
14 are in a directory called `debug` and the %IMP source is in a directory at
15 `../imp`. We are using the default of makefiles for the actual building.
16 
17 Note that we need CMake 2.8 or later; on RHEL/CentOS systems this is provided
18 by the `cmake28` package in EPEL (and type `cmake28` rather than `cmake` on
19 the command line).
20 
21 # Configuring with cmake command line options {#cmake_cmdline}
22 
23 To configure and build as simply as possible do
24 
25  cmake ../imp
26  make -j8
27 
28 To make a debug build of %IMP with the `cgal` and `membrane` modules disabled
29 and `core` compiled in per-cpp mode, and to use
30 [Ninja](https://martine.github.io/ninja/) instead of `make` as your build
31 command do:
32 
33  cmake ../imp -DCMAKE_BUILD_TYPE=Debug -G Ninja -DIMP_DISABLED_MODULES=cgal:membrane -DIMP_PER_CPP_COMPILATION=core
34  ninja -j8
35 
36 # Configuring using ccmake {#ccmake_config}
37 1. Run `ccmake ../imp`
38 You can then look through the various options available.
39 2. If you want a debug build, set `CMAKE_BUILD_TYPE` to `Debug`
40 3. Tell cmake to configure (hit `c`) and generate (hit `g`)
41 4. `make -j8`
42 
43 You can run `ccmake` after running `cmake` as above if you want, too.
44 Running it never hurts.
45 
46 # Further configuration options {#cmake_further}
47 
48 You can use [Ninja](https://martine.github.io/ninja/)
49 instead if it is available by passing `-G Ninja` to the `(c)cmake` call.
50 That is highly recommended when it is available.
51 
52 Various aspects of %IMP build behavior can be controlled via variables. These can be set interactively using `ccmake` (eg `ccmake ../imp`) or by passing them with `-D` in a call to `cmake`. Key ones include:
53 - `IMP_DISABLED_MODULES`: A colon-separated list of disabled modules.
54 - `IMP_MAX_CHECKS`: One of `NONE`, `USAGE`, `INTERNAL` to control what check levels will be supported.
55 - `IMP_MAX_LOG`: One of `SILENT`, `PROGRESS`, `TERSE`, `VERBOSE` to control what log levels are supported.
56 - `IMP_PER_CPP_COMPILATION`: A colon-separated list of modules to build one .cpp at a time.
57 - `CMAKE_BUILD_TYPE`: one of `Debug` or `Release`.
58 
59 There also are a [variety of standard cmake options](http://www.cmake.org/Wiki/CMake_Useful_Variables) which control the build. For example:
60 - `CMAKE_INCLUDE_PATH` and `CMAKE_LIBRARY_PATH` control the paths CMake searches
61  in to locate %IMP prerequisite libraries. If your libraries are installed in
62  non-standard locations, you can set these variables to help CMake find them.
63  For example, on a 32-bit RHEL5 system, which has both Boost and HDF5 in
64  non-standard locations, we use
65 
66  -DCMAKE_INCLUDE_PATH="/usr/include/boost141;/usr/include/hdf518/" -DCMAKE_LIBRARY_PATH="/usr/lib/boost141;/usr/lib/hdf518"
67 
68 - `CMAKE_INSTALL_PREFIX` should be set if you want to install %IMP in a
69  non-standard location.
70 
71 Note also that CMake searches in the system path (`PATH` environment variable)
72 for command line tools such as `python` and `swig`. Thus, if you have multiple
73 versions of tools (e.g. `/usr/bin/swig` and `/usr/local/bin/swig`) make sure
74 the `PATH` variable is set correctly so that the right tool is found *before*
75 you run CMake. You may need to make symlinks or copies to help it out if your
76 binaries are named oddly; for example on a RHEL5 system we need to force CMake
77 to use `/usr/bin/python2.6` rather than `/usr/bin/python` (which is Python 2.4,
78 which is too old to work with %IMP) by doing something like:
79 
80  mkdir bin
81  ln -sf /usr/bin/python26 bin/python
82  PATH=`pwd`/bin:$PATH