Changes between Initial Version and Version 1 of CMakeAddingALibrary


Ignore:
Timestamp:
Jun 12, 2007, 3:27:42 AM (15 years ago)
Author:
Douglas Gregor
Comment:

Initial stab at documentation for adding a library to the CMake build system

Legend:

Unmodified
Added
Removed
Modified
  • CMakeAddingALibrary

    v1 v1  
     1= Adding a Boost Library with CMake =
     2This page describes how to introduce a new Boost library into the CMake-based build system. Any Boost library that provides a library binary (e.g., `boost_signals.dll`) or has regression tests (hopefully, every Boost library!) will need to be part of the build system.
     3
     4To introduce a new library, which resides in the subdirectory `libs/libname`, follow these steps:
     5
     6  1. Create a new file `libs/libname/CMakeLists.txt` with your favorite text editor. This file will contain an invocation of the [wiki:CMakeLibraryProject `boost_library_project` macro], which identifies each Boost library to the build system. The invocation of the `boost_library_project` will look like this:
     7  {{{
     8boost_library_project(
     9  Libname
     10  SRCDIRS src
     11  TESTDIRS test
     12  )
     13}}}
     14
     15  where `Libname` is the properly-capitalization library name, e.g., `Signals` or `Smart_ptr`. The `SRCDIRS src` line should only be present if your Boost library actually needs to compile a library binary; header-only libraries can skip this step. The `TESTDIRS test` line indicates that the subdirectory `test` contains regression tests for your library. Every Boost library should have these.
     16
     17  2. [wiki:CMakeConfigAndBuild Re-run CMake] to reconfigure the source tree, causing CMake to find the new Boost library. CMake can be re-run either from the command line (by invoking `cmake /path/to/boost` or `ccmake /path/to/boost`) or, on Windows, using the CMake GUI. Once you have reconfigured and generated new makefiles or project files, CMake knows about your library.
     18
     19  3. If your library has compiled sources (i.e., it is not a header-only library), follow the instructions on [wiki:CMakeAddingCompiledLibrary adding a compiled library] to get CMake building and installing your library.
     20
     21  4. If your library has regression tests (it ```does``` have regression tests, right?), follow the instructions on [wiki:CMakeAddingRegressionTests adding regression tests] to get CMake to build and run regression tests for your library.