Changes between Version 5 and Version 6 of CMakeConfigAndBuild
- Timestamp:
- Jun 12, 2007, 5:44:48 PM (15 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
CMakeConfigAndBuild
v5 v6 2 2 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. 3 3 4 * [http://www.cmake.org/HTML/Download.html 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 [http://www.cmake.org/HTML/Install.html CMake installation instructions]. In these instructions, we will do things such that the Boost source tree (with CMake build files) is available in the directory `$BOOST/src` and that the build will happen in `$BOOST/build`: 4 == [http://www.cmake.org/HTML/Download.html Download CMake] == 5 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 [http://www.cmake.org/HTML/Install.html CMake installation instructions]. In these instructions, we will do things such that the Boost source tree (with CMake build files) is available in the directory `$BOOST/src` and that the build will happen in `$BOOST/build`: 5 6 {{{ 6 7 $BOOST/ … … 11 12 Note that it is '''not''' actually necessary to set any environment variable `BOOST`, this is a convention used in this document. 12 13 13 * 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 [wiki:BoostSubversion Boost Subversion repository] with the URL http://svn.boost.org/svn/boost/sandbox-branches/boost-cmake/boost_1_34_0]. So, 14 == Check out Boost-CMake == 15 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 [wiki:BoostSubversion Boost Subversion repository] with the URL http://svn.boost.org/svn/boost/sandbox-branches/boost-cmake/boost_1_34_0]. 16 17 On unix: 14 18 {{{ 15 19 mkdir $BOOST … … 17 21 }}} 18 22 19 * 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. 20 * '''On Windows''': Run CMake by selecting it from the Start menu. 23 == Configure the Boost source tree == 24 This is the makefile generation step, using `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. 25 26 === On Windows === 27 Run CMake by selecting it from the Start menu. 21 28 * Use the `Browse...` button to point CMake at the Boost source code in `$BOOST\src`. 22 29 * Use the second `Browse...` button to select the directory where Boost will build binaries, `$BOOST\build`. 23 30 * 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. 24 31 * Click "Configure" to configure Boost, which will search for various libraries on your system and prepare the build. 25 * 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".32 * If you want, you can edit various options in the CMake GUI (see also [wiki:CMakeBuildConfiguration]. These options will affect what libraries are built and how. Each time you finish editing options, click "Configure". 26 33 * When you are done, click "OK" to generate project files. 27 * '''On Unix''': 28 * Create the directory that will hold the binaries that CMake builds: 29 {{{ 30 mkdir $BOOST/build 31 32 *Change into the binary directory you have just created:33 34 cd $BOOST/build 35 36 *Run the CMake configuration program, providing it with the Boost source directory:37 38 cmake $BOOST/src 39 40 You'll see output from `cmake`. On unix it lookslike this:41 34 === On Unix === 35 Create the directory that will hold the binaries that CMake build, 36 {{{ 37 mkdir $BOOST/build 38 }}} 39 Change into the binary directory you have just created: 40 {{{ 41 cd $BOOST/build 42 }}} 43 Run the CMake configuration program, providing it with the Boost source directory: 44 {{{ 45 cmake $BOOST/src 46 }}} 47 You'll see output from `cmake`. It looks somewhat like this: 48 {{{ 42 49 % cmake $BOOST/src 43 50 -- Check for working C compiler: /usr/bin/gcc … … 52 59 -- + crc 53 60 -- + mpl 54 -- + tr1 55 -- + bind 56 [snip] 61 62 (etc, etc) 63 57 64 -- + program_options 58 65 -- + ptr_container … … 63 70 }}} 64 71 65 The directory `$BOOST/build` should now contain a bunch of generated files, including a top level `Makefile`, something like this:72 The directory `$BOOST/build` should now contain a bunch of generated files, including a top level `Makefile`, something like this: 66 73 {{{ 67 74 % ls … … 73 80 That's it! You've now configured your source tree and are ready to start building Boost. 74 81 75 * Build Boost: Like configuration, the way in which one builds Boost with CMake differs from one platform to another, depending on your platform and how you configured CMake. Either way, you'll be using the tools provided to you by your compiler or operating system vendor. 76 * '''Microsoft Visual Studio''': If you have generated project files for Microsoft Visual Studio, you will need to start up Visual Studio to build Boost. Once Visual Studio has loaded, load the solution or project`Boost` from the Boost binary directory you set in the CMake configuration earlier. Then, just click "Build" to build all of Boost. 77 * '''On Unix''' (and when using makefile variants on Microsoft Windows): If you are on Unix, you will build Boost using standard "make" tools. In the directory $BOOST/build (where the generated makefiles are) run `make`: 78 {{{ 82 == Build Boost == 83 Like configuration, the way in which one builds Boost with CMake differs from one platform to another, depending on your platform and how you configured CMake. Either way, you'll be using the tools provided to you by your compiler or operating system vendor. 84 === Microsoft Visual Studio === 85 If you have generated project files for Microsoft Visual Studio, you will need to start up Visual Studio to build Boost. Once Visual Studio has loaded, load the solution or project`Boost` from the Boost binary directory you set in the CMake configuration earlier. Then, just click "Build" to build all of Boost. 86 === On Unix (and when using makefile variants on Microsoft Windows) === 87 One builds using standard "make" tools. In the directory $BOOST/build (where the generated makefiles are) run `make`: 88 {{{ 79 89 make 80 90 }}} 81 91 82 *That's it! Once the build completes (which make take a while, if you are building all of the Boost libraries), the Boost libraries will be available in the `lib` subdirectory of your binary directory, ready to be used, installed, or packaged.92 That's it! Once the build completes (which make take a while, if you are building all of the Boost libraries), the Boost libraries will be available in the `lib` subdirectory of your binary directory, ready to be used, installed, or packaged. 83 93 84 94 == Installing Boost ==