| 1 | = Configuration tools = |
| 2 | The Windows `CMake` gui and the unix `ccmake` curses interface allow one to configure various aspects of the cmake build. |
| 3 | |
| 4 | On unix, run |
| 5 | {{{ |
| 6 | ccmake <path-to-source> |
| 7 | }}} |
| 8 | or |
| 9 | {{{ |
| 10 | ccmake <path-to-build> |
| 11 | }}} |
| 12 | and you are presented with a list of editable build options something like this: |
| 13 | {{{ |
| 14 | BUILD_BOOST_DATE_TIME ON |
| 15 | BUILD_BOOST_FILESYSTEM ON |
| 16 | BUILD_BOOST_GRAPH ON |
| 17 | BUILD_BOOST_IOSTREAMS ON |
| 18 | BUILD_BOOST_PROGRAM_OPTIONS ON |
| 19 | BUILD_BOOST_PYTHON ON |
| 20 | BUILD_BOOST_REGEX ON |
| 21 | BUILD_BOOST_SERIALIZATION ON |
| 22 | BUILD_BOOST_SIGNALS ON |
| 23 | BUILD_BOOST_TEST ON |
| 24 | BUILD_BOOST_THREAD ON |
| 25 | BUILD_BOOST_WAVE ON |
| 26 | BUILD_BOOST_WSERIALIZATION ON |
| 27 | BUILD_DEBUG ON |
| 28 | BUILD_MULTI_THREADED ON |
| 29 | BUILD_RELEASE ON |
| 30 | BUILD_SHARED ON |
| 31 | BUILD_SINGLE_THREADED ON |
| 32 | BUILD_STATIC ON |
| 33 | BUILD_TESTING OFF |
| 34 | BUILD_VERSIONED ON |
| 35 | CMAKE_BACKWARDS_COMPATIBILITY 2.4 |
| 36 | CMAKE_BUILD_TYPE |
| 37 | CMAKE_INSTALL_PREFIX /usr/local |
| 38 | DEBUG_COMPILE_FLAGS -g |
| 39 | EXECUTABLE_OUTPUT_PATH |
| 40 | LIBRARY_OUTPUT_PATH |
| 41 | PYTHON_EXECUTABLE /usr/bin/python2.4 |
| 42 | PYTHON_INCLUDE_PATH /usr/include/python2.4 |
| 43 | PYTHON_LIBRARY /usr/lib/python2.4/config/libpython2.4.so |
| 44 | RELEASE_COMPILE_FLAGS -O3 -DNDEBUG |
| 45 | |
| 46 | |
| 47 | BUILD_VERSIONED: Use versioned library names, e.g., boost_filesystem-gcc41-1_34 |
| 48 | Press [enter] to edit option CMake Version 2.4 - patch 5 |
| 49 | Press [c] to configure Press [g] to generate and exit |
| 50 | Press [h] for help Press [q] to quit without generating |
| 51 | Press [t] to toggle advanced mode (Currently Off) |
| 52 | }}} |
| 53 | |
| 54 | Use the arrow keys to select particular options. Press '''''c''''' (for (c)onfigure) to perform the preliminary configuration of the CMake build system when you are done. |
| 55 | When the options you have selected have stabilized, CMake will give you the (g)enerate option. If you do not see this option, press '''''c''''' again to reconfigure. Finally, press '''''g''''' to generate makefiles and exit. |
| 56 | |
| 57 | Presumably the windows GUI needs no such explanation. |
| 58 | |
| 59 | == CMakeCache.txt == |
| 60 | |
| 61 | The values of these options are stored in a file `CMakeCache.txt` located in the build directory. This is what `ccmake` reads if it is started pointing to a build directory. This file is hand-editable. An excerpt: |
| 62 | {{{ |
| 63 | // |
| 64 | // Enable/Disable color output during build. |
| 65 | // |
| 66 | CMAKE_COLOR_MAKEFILE:BOOL=ON |
| 67 | |
| 68 | // |
| 69 | // Use versioned library names, e.g., boost_filesystem-gcc41-1_34 |
| 70 | // |
| 71 | BUILD_VERSIONED:BOOL=ON |
| 72 | }}} |
| 73 | |
| 74 | The makefiles that CMake generates will detect if this file has been edited and will automatically re-perform the makefile generation phase. If you should need to trigger this regeneration manually you may execute |
| 75 | {{{ |
| 76 | make rebuild_cache |
| 77 | }}} |
| 78 | |
| 79 | = Useful options = |
| 80 | |
| 81 | ||'''''Option'''''||'''''Description'''''|| |
| 82 | ||`CMAKE_VERBOSE_MAKEFILE`||Displays full build commands during build. Good for debugging.|| |
| 83 | ||`CMAKE_OSX_ARCHITECTURES`||'''Mac OS X users''': to build universal binaries, set this to `ppc;i386`.|| |
| 84 | ||`BUILD_BOOST_`''library''||Toggles building and testing of ''library'' (e.g. this will appear as `BUILD_BOOST_REGEX`, `BUILD_BOOST_PROGRAM_OPTIONS`, etc.|| |
| 85 | || `BUILD_TESTING` || Toggles build of testing || |
| 86 | || `TEST_BOOST`_''library'' || Toggles testing of ''library'' (this option appears only if `BUILD_BOOST`_''library'' and `BUILD_TESTING` are enabled || |
| 87 | || `BUILD_VERSIONED` || Toggles mangling of compiler name and boost version into library names || |
| 88 | || `BUILD_`''feature'' || Toggles build of feature ''feature'', where ''feature'' comes from the list found at [wiki:CMakeBuildFeatures], e.g. `BUILD_RELEASE`, `BUILD_DEBUG`, `BUILD_MULTI_THREADED`, etc.|| |
| 89 | |
| 90 | |