wiki:CMakeConfigAndBuild

Version 2 (modified by Douglas Gregor, 15 years ago) ( diff )

Fix nesting/labelling

Configuring and Building Boost with CMake

This page describes how to configure and build Boost with CMake. By following these instructions, you should be able to get CMake, configure a Boost build tree to your liking with CMake, and then build, install, and package Boost libraries.

  1. Download CMake: There are precompiled binaries for CMake on several different platforms. The installation of these pre-compiled binaries is mostly self-explanatory. If you need to build your own copy of CMake, please see the CMake installation instructions. In these instructions, we will assume that the Boost source tree, with CMake build files, is available in the directory $BOOST_ROOT.
  1. Download Boost with CMake: At present, the CMake build system is developed externally from Boost itself. To get a copy of Boost 1.34.0 with the CMake build system, retrieve it from the Boost Subversion repository with the URL http://svn.boost.org/svn/boost/sandbox-branches/boost-cmake/boost_1_34_0].
  1. Configure the Boost source tree with CMake's configuration tool. This step differs depending on whether you are using CMake's GUI on Microsoft Windows or whether you are using the command-line tools provided on Unix.
    1. On Windows: Run CMake by selecting it from the Start menu.
      1. Use the Browse... button to point CMake at the Boost source code in $BOOST_ROOT.
      2. Use the second Browse... button to select the directory where Boost will build binaries.
      3. CMake will ask you what kind of project files or make files to build. If you're using Microsoft Visual Studio, select the appropriate version to generate project files. Otherwise, you can use Borland's make files, generate NMake files, etc.
      4. Click "Configure" to configure Boost, which will search for various libraries on your system and prepare the build.
      5. If you want, you can edit various options in the CMake GUI. These options will affect what libraries are built and how. Each time you finish editing options, click "Configure".
      6. When you are done, click "OK" to generate project files.
    2. On Unix:
      1. Create a new directory that will hold the binaries that CMake builds. This document will assume you have created used the directory name boost-bin for these binaries, and that this directory is not inside $BOOST_ROOT:
        mkdir boost-bin
        
      2. Change into the binary directory you have just created:
        cd boost-bin
        
      3. Run the CMake configuration program, providing it with the Boost source directory:
        ccmake $BOOST_ROOT
        
      4. Press c (for (c)onfigure) to perform the preliminary configuration of the CMake build system.
      5. If you want, you can edit various options in the CMake interface. These options will affect what libraries are built and how. Each time you finish editing options, press c to reconfigure.
      6. 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.

That's it! You've now configured your source tree and are ready to start building Boost.

  1. Build Boost: Like configuration, the way in which one builds Boost with CMake differs from one platform to another, depending on
Note: See TracWiki for help on using the wiki.