wiki:CMakeLibraryProject

CMake Macro Reference: boost_library_project

The boost_library_project macro defines a Boost library project (e.g., for Boost.Python). It should be used only once per library, in the file libs/libname/CMakeLists.txt. The syntax of this macro is:

boost_library_project(libname
                      [SRCDIRS srcdir1 srcdir2 ...] 
                      [TESTDIRS testdir1 testdir2 ...]
                      [DESCRIPTION description]
                      [AUTHORS author1 author2 ...]
                      [MAINTAINERS maint1 maint2 ...]
                      [MODULAR])

where libname is the name of the library (e.g., Python, Filesystem), srcdir1, srcdir2, etc, are subdirectories containing library sources (for Boost libraries that build actual library binaries), and testdir1, testdir2, etc, are subdirectories containing regression tests.

A library marked MODULAR has all of its header files in its own subdirectory include/boost rather than the "global" boost subdirectory. These libraries can be added or removed from the tree freely; they do not need to be a part of the main repository. DESCRIPTION provides a brief description of the library, which can be used to summarize the behavior of the library for a user. AUTHORS lists the authors of the library, while MAINTAINERS lists the active maintainers. If MAINTAINERS is left empty, it is assumed that the authors are still maintaining the library. Both authors and maintainers should have their name followed by their current e-mail address in angle brackets, with -at- instead of the at sign, e.g.,

Douglas Gregor <doug.gregor -at- gmail.com>

For libraries that build actual library binaries, this macro adds a option BUILD_BOOST_LIBNAME (which defaults to ON). When the option is ON, this macro will include the source subdirectories, and therefore, will build and install the library binary.

For libraries that have regression tests, and when testing is enabled globally by the BUILD_TESTING option, this macro also defines the TEST_BOOST_LIBNAME option (defaults to ON). When ON, the generated makefiles/project files will contain regression tests for this library.

Example

The Boost.Thread library uses the following invocation of the boost_library_project macro, since it has both a compiled library (built in the "src" subdirectory) and regression tests (listed in the "test" subdirectory).

boost_library_project(
  Thread
  SRCDIRS src 
  TESTDIRS test 
  DESCRIPTION "Portable threading"
  AUTHORS "Anthony Williams <anthony -at- justsoftwaresolutions.co.uk">
  )

Where Defined

This macro is defined in the Boost Core module in tools/build/CMake/BoostCore.cmake

Last modified 14 years ago Last modified on May 23, 2008, 3:26:05 AM
Note: See TracWiki for help on using the wiki.