| 1 | = CMake Reference: `boost_library_project` = |
| 2 | |
| 3 | 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: |
| 4 | |
| 5 | {{{ |
| 6 | boost_library_project(libname |
| 7 | [SRCDIRS srcdir1 srcdir2 ...] |
| 8 | [TESTDIRS testdir1 testdir2 ...]) |
| 9 | }}} |
| 10 | |
| 11 | where `libname` is the name of the library (e.g., Python, |
| 12 | Filesystem), `srcdir1`, `srcdir2`, etc, are subdirectories containing |
| 13 | library sources (for Boost libraries that build actual library |
| 14 | binaries), and `testdir1`, `testdir2`, etc, are subdirectories |
| 15 | containing regression tests. |
| 16 | |
| 17 | For libraries that build actual library binaries, this macro adds a |
| 18 | option `BUILD_BOOST_LIBNAME` (which defaults to ON). When the option |
| 19 | is ON, this macro will include the source subdirectories, and |
| 20 | therefore, will build and install the library binary. |
| 21 | |
| 22 | For libraries that have regression tests, and when testing is |
| 23 | enabled globally by the `BUILD_TESTING` option, this macro also |
| 24 | defines the `TEST_BOOST_LIBNAME` option (defaults to ON). When ON, the |
| 25 | generated makefiles/project files will contain regression tests for |
| 26 | this library. |
| 27 | |
| 28 | == Example == |
| 29 | 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). |
| 30 | |
| 31 | {{{ |
| 32 | boost_library_project( |
| 33 | Thread |
| 34 | SRCDIRS src |
| 35 | TESTDIRS test |
| 36 | ) |
| 37 | }}} |
| 38 | |
| 39 | This example is from [http://svn.boost.org/svn/boost/sandbox-branches/boost-cmake/boost_1_34_0/libs/thread/CMakeLists.txt libs/thread/CMakeLists.txt]. |
| 40 | |
| 41 | == Where Defined == |
| 42 | This macro is defined in the Boost Core module in [http://svn.boost.org/svn/boost/sandbox-branches/boost-cmake/boost_1_34_0/tools/build/CMake/BoostCore.cmake tools/build/CMake/BoostCore.cmake] |