{"id":20077262,"url":"https://github.com/boostorg/cmake","last_synced_at":"2026-02-07T06:31:39.998Z","repository":{"id":37520847,"uuid":"228215402","full_name":"boostorg/cmake","owner":"boostorg","description":"CMake support infrastructure Boost submodule","archived":false,"fork":false,"pushed_at":"2026-02-02T11:39:36.000Z","size":264,"stargazers_count":114,"open_issues_count":13,"forks_count":36,"subscribers_count":13,"default_branch":"develop","last_synced_at":"2026-02-03T01:07:48.060Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"CMake","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/boostorg.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2019-12-15T16:30:04.000Z","updated_at":"2026-01-29T20:55:44.000Z","dependencies_parsed_at":"2023-12-31T13:29:26.292Z","dependency_job_id":"a75b645b-10f8-44f4-87c7-227907983662","html_url":"https://github.com/boostorg/cmake","commit_stats":null,"previous_names":[],"tags_count":34,"template":false,"template_full_name":null,"purl":"pkg:github/boostorg/cmake","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/boostorg%2Fcmake","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/boostorg%2Fcmake/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/boostorg%2Fcmake/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/boostorg%2Fcmake/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/boostorg","download_url":"https://codeload.github.com/boostorg/cmake/tar.gz/refs/heads/develop","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/boostorg%2Fcmake/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29188226,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-07T05:07:31.176Z","status":"ssl_error","status_checked_at":"2026-02-07T05:06:15.227Z","response_time":63,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-13T15:06:46.218Z","updated_at":"2026-02-07T06:31:39.993Z","avatar_url":"https://github.com/boostorg.png","language":"CMake","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Boost CMake support infrastructure\n\nThis repository hosts the `tools/cmake` Boost submodule, containing\nthe CMake support infrastructure for Boost.\n\nNote that the officially supported way to build Boost remains\n[with `b2`](https://www.boost.org/more/getting_started/index.html).\n\n## Building Boost with CMake\n\nThe first thing you need to know is that the\n[official Boost releases](https://www.boost.org/users/download/)\ncan't be built with CMake. Even though the Boost Github repository\ncontains a `CMakeLists.txt` file, it's removed from the release.\n\nThat's because the file and directory layout of Boost releases,\nfor historical reasons, has all the Boost header files copied\ninto a single `boost/` directory. These headers are then removed\nfrom the individual library `include/` directories. The CMake\nsupport infrastructure expects the headers to remain in their\nrespective `libs/\u003clibname\u003e/include` directories, and therefore\ndoes not work on a release archive.\n\nTo build Boost with CMake, you will need either a Git clone\nof Boost\n(`git clone --recurse-submodules https://github.com/boostorg/boost`)\nor the alternative archives\n[available on Github](https://github.com/boostorg/boost/releases).\n\nOnce you have cloned, or downloaded and extracted, Boost, use the\nusual procedure of\n\n```\nmkdir __build\ncd __build\ncmake ..\ncmake --build .\n```\n\nto build it with CMake. To install it, add\n\n```\ncmake --build . --target install\n```\n\nUnder Windows (when using the Visual Studio generator), you can\ncontrol whether Debug or Release variants are built by adding\n`--config Debug` or `--config Release` to the `cmake --build` lines:\n\n```\ncmake --build . --config Debug\n```\n\n```\ncmake --build . --target install --config Debug\n```\n\nThe default is Debug. You can build and\ninstall both Debug and Release at the same time, by running the\nrespective `cmake --build` line twice, once per `--config`:\n\n```\ncmake --build . --target install --config Debug\ncmake --build . --target install --config Release\n```\n\n## Configuration variables\n\nThe following variables are supported and can be set either from\nthe command line as `cmake -DVARIABLE=VALUE ..`, or via `ccmake`\nor `cmake-gui`:\n\n* `BOOST_INCLUDE_LIBRARIES`\n\n  A semicolon-separated list of libraries to include into the build (and\n  installation.) Defaults\n  to empty, which means \"all libraries\". Example: `filesystem;regex`.\n\n* `BOOST_EXCLUDE_LIBRARIES`\n\n  A semicolon-separated list of libraries to exclude from the build (and\n  installation.) This is useful if a library causes an error in the CMake\n  configure phase.\n\n* `BOOST_ENABLE_MPI`\n\n  Set to ON if Boost libraries depending on MPI should be built.\n\n* `BOOST_ENABLE_PYTHON`\n\n  Set to ON if Boost libraries depending on Python should be built.\n\n* [`CMAKE_BUILD_TYPE`](https://cmake.org/cmake/help/latest/variable/CMAKE_BUILD_TYPE.html)\n\n  For single-configuration generators such as Makefile and Ninja (the typical\n  case under POSIX operating systems), controls the build variant (Debug or\n  Release.) The default when building Boost is set to Release.\n\n  For multi-configuration generators such as the Visual Studio generators,\n  `CMAKE_BUILD_TYPE` is ignored; the desired configuration is set at build\n  (or install) time, with the `--config` option to `cmake --build` and\n  `cmake --install`.\n\n  For more information, see\n  [the CMake documentation on build configurations](https://cmake.org/cmake/help/latest/manual/cmake-buildsystem.7.html#build-configurations).\n\n* [`CMAKE_INSTALL_PREFIX`](https://cmake.org/cmake/help/latest/variable/CMAKE_INSTALL_PREFIX.html)\n\n  A standard CMake variable that determines where the headers and libraries\n  should be installed. The default when building Boost is set to `C:/Boost`\n  under Windows, `/usr/local` otherwise.\n\n* [`CMAKE_INSTALL_INCLUDEDIR`](https://cmake.org/cmake/help/latest/module/GNUInstallDirs.html)\n\n  Directory in which to install the header files. Can be relative to\n  `CMAKE_INSTALL_PREFIX`. Default `include`.\n\n* [`CMAKE_INSTALL_BINDIR`](https://cmake.org/cmake/help/latest/module/GNUInstallDirs.html)\n\n  Directory in which to install the binary artifacts (executables and Windows\n  DLLs.) Can be relative to `CMAKE_INSTALL_PREFIX`. Default `bin`.\n\n* [`CMAKE_INSTALL_LIBDIR`](https://cmake.org/cmake/help/latest/module/GNUInstallDirs.html)\n\n  Directory in which to install the compiled libraries. Can be relative to\n  `CMAKE_INSTALL_PREFIX`. Default `lib`.\n\n* [`CMAKE_INSTALL_DATADIR`](https://cmake.org/cmake/help/latest/module/GNUInstallDirs.html)\n\n  Directory in which to install the data files (e.g. debugger visualizers).\n  Can be relative to `CMAKE_INSTALL_PREFIX`. Default `share`.\n\n* `BOOST_INSTALL_CMAKEDIR`\n\n  Directory in which to install the CMake configuration files. Default `lib/cmake`.\n\n* `BOOST_INSTALL_LAYOUT`\n\n  Boost installation layout. Can be one of `system`, `tagged`, or `versioned`.\n  The default is `versioned` under Windows, and `system` otherwise.\n\n  `versioned` produces library names of the form\n  `libboost_timer-vc143-mt-gd-x64-1_82.lib`, containing the toolset (compiler)\n  name and version, encoded build settings, and the Boost version. (The\n  extension is `.lib` under Windows, `.a` or `.so` under Linux, and `.a` or\n  `.dylib` under macOS.)\n\n  `tagged` produces library names of the form `libboost_timer-mt-gd-x64.lib`;\n  only the build settings are encoded in the name, the toolset and the Boost\n  version are not.\n\n  `system` produces library names of the form `libboost_timer.lib` (or\n  `libboost_timer.a`, `libboost_timer.so`, `libboost_timer.dylib`.)\n\n* `BOOST_INSTALL_INCLUDE_SUBDIR`\n\n  When `BOOST_INSTALL_LAYOUT` is `versioned`, headers are installed in a\n  subdirectory of `CMAKE_INSTALL_INCLUDEDIR` (to enable several Boost releases\n  being installed at the same time.) The default for release e.g. 1.81 is\n  `/boost-1_81`.)\n\n* `BOOST_RUNTIME_LINK`\n\n  Whether to use the static or the shared C++ runtime libraries under Microsoft\n  Visual C++ and compatible compilers. (The available values are `shared` and\n  `static` and the default is `shared`.)\n\n* [`BUILD_TESTING`](https://cmake.org/cmake/help/latest/module/CTest.html)\n\n  A standard CMake variable; when ON, tests are configured and built. Defaults\n  to OFF.\n\n* [`BUILD_SHARED_LIBS`](https://cmake.org/cmake/help/latest/variable/BUILD_SHARED_LIBS.html)\n\n  A standard CMake variable that determines whether to build shared or static\n  libraries. Defaults to OFF.\n\n* `BOOST_STAGEDIR`\n\n  The directory in which to place the build outputs. Defaults to the `stage`\n  subdirectory of the current CMake binary directory.\n\n  The standard CMake variables\n  [`CMAKE_RUNTIME_OUTPUT_DIRECTORY`](https://cmake.org/cmake/help/latest/variable/CMAKE_RUNTIME_OUTPUT_DIRECTORY.html),\n  [`CMAKE_LIBRARY_OUTPUT_DIRECTORY`](https://cmake.org/cmake/help/latest/variable/CMAKE_LIBRARY_OUTPUT_DIRECTORY.html),\n  and\n  [`CMAKE_ARCHIVE_OUTPUT_DIRECTORY`](https://cmake.org/cmake/help/latest/variable/CMAKE_ARCHIVE_OUTPUT_DIRECTORY.html)\n  are set by default to `${BOOST_STAGEDIR}/bin`, `${BOOST_STAGEDIR}/lib`, and\n  `${BOOST_STAGEDIR}/lib`, respectively.\n\n* [`CMAKE_CXX_VISIBILITY_PRESET`](https://cmake.org/cmake/help/latest/variable/CMAKE_LANG_VISIBILITY_PRESET.html)\n\n  C++ symbol visibility (one of `default`, `hidden`, `protected`, `internal`). The default is set to `hidden` to match `b2`.\n\n* [`CMAKE_C_VISIBILITY_PRESET`](https://cmake.org/cmake/help/latest/variable/CMAKE_LANG_VISIBILITY_PRESET.html)\n\n  C symbol visibility (one of `default`, `hidden`, `protected`, `internal`). The default is set to `hidden` to match `b2`.\n\n* [`CMAKE_VISIBILITY_INLINES_HIDDEN`](https://cmake.org/cmake/help/latest/variable/CMAKE_VISIBILITY_INLINES_HIDDEN.html)\n\n  Whether inline functions should have hidden visibility. The default is set to `ON` to match `b2`.\n\n## Library-specific configuration variables\n\nSome Boost libraries provide their own configuration variables, some of which\nare given below.\n\n### Context\n\n* `BOOST_CONTEXT_BINARY_FORMAT`\n\n  Allowed values are `elf`, `mach-o`, `pe`, `xcoff`. The default is\n  autodetected from the platform.\n\n* `BOOST_CONTEXT_ABI`\n\n  Allowed values are `aapcs`, `eabi`, `ms`, `n32`, `n64`, `o32`, `o64`, `sysv`,\n  `x32`. The default is autodetected from the platform.\n\n* `BOOST_CONTEXT_ARCHITECTURE`\n\n  Allowed values are `arm`, `arm64`, `loongarch64`, `mips32`, `mips64`,\n  `ppc32`, `ppc64`, `riscv64`, `s390x`, `i386`, `x86_64`, `combined`.\n  The default is autodetected from the platform.\n\n* `BOOST_CONTEXT_ASSEMBLER`\n\n  Allowed values are `masm`, `gas`, `armasm`. The default is autodetected from\n  the platform.\n\n* `BOOST_CONTEXT_ASM_SUFFIX`\n\n  Allowed values are `.asm` and `.S`. The default is autodetected from the\n  platform.\n\n* `BOOST_CONTEXT_IMPLEMENTATION`\n\n  Allowed values are `fcontext`, `ucontext`, `winfib`. Defaults to `fcontext`.\n\n### Fiber\n\n* `BOOST_FIBER_NUMA_TARGET_OS`\n\n  Target OS for the Fiber NUMA support. Can be `aix`, `freebsd`, `hpux`,\n  `linux`, `solaris`, `windows`, `none`. Defaults to `windows` under Windows,\n  `linux` under Linux, otherwise `none`.\n\n### IOStreams\n\n* `BOOST_IOSTREAMS_ENABLE_ZLIB`\n\n  When ON, enables ZLib support. Defaults to ON when `zlib` is found, OFF\n  otherwise.\n\n* `BOOST_IOSTREAMS_ENABLE_BZIP2`\n\n  When ON, enables BZip2 support. Defaults to ON when `libbzip2` is found,\n  OFF otherwise.\n\n* `BOOST_IOSTREAMS_ENABLE_LZMA`\n\n  When ON, enables LZMA support. Defaults to ON when `liblzma` is found,\n  OFF otherwise.\n\n* `BOOST_IOSTREAMS_ENABLE_ZSTD`\n\n  When ON, enables Zstd support. Defaults to ON when `libzstd` is found,\n  OFF otherwise.\n\n### Locale\n\n* `BOOST_LOCALE_ENABLE_ICU`\n\n  When ON, enables the ICU backend. Defaults to ON when ICU is found,\n  OFF otherwise.\n\n* `BOOST_LOCALE_ENABLE_ICONV`\n\n  When ON, enables the Iconv backend. Defaults to ON when `iconv` is found,\n  OFF otherwise.\n\n* `BOOST_LOCALE_ENABLE_POSIX`\n\n  When ON, enables the POSIX backend. Defaults to ON on POSIX systems,\n  OFF otherwise.\n\n* `BOOST_LOCALE_ENABLE_STD`\n\n  When ON, enables the `std::locale` backend. Defaults to ON.\n\n* `BOOST_LOCALE_ENABLE_WINAPI`\n\n  When ON, enables the Windows API backend. Defaults to ON under Windows, OFF\n  otherwise.\n\n### Stacktrace\n\n* `BOOST_STACKTRACE_ENABLE_NOOP`\n\n  When ON, builds the `boost_stacktrace_noop` library variant. Defaults to ON.\n\n* `BOOST_STACKTRACE_ENABLE_BACKTRACE`\n\n  When ON, builds the `boost_stacktrace_backtrace` library variant. Defaults\n  to ON when `libbacktrace` is found, OFF otherwise.\n\n* `BOOST_STACKTRACE_ENABLE_ADDR2LINE`\n\n  When ON, builds the `boost_stacktrace_addr2line` library variant. Defaults\n  to ON, except on Windows.\n\n* `BOOST_STACKTRACE_ENABLE_BASIC`\n\n  When ON, builds the `boost_stacktrace_basic` library variant. Defaults to ON.\n\n* `BOOST_STACKTRACE_ENABLE_WINDBG`\n\n  When ON, builds the `boost_stacktrace_windbg` library variant. Defaults to\n  ON under Windows when WinDbg support is autodetected, otherwise OFF.\n\n* `BOOST_STACKTRACE_ENABLE_WINDBG_CACHED`\n\n  When ON, builds the `boost_stacktrace_windbg_cached` library variant.\n  Defaults to ON under Windows when WinDbg support is autodetected and when\n  `thread_local` is supported, otherwise OFF.\n\n### Test\n\n* `BOOST_TEST_HEADERS_ONLY`\n\n  When ON, installs only headers required for using the header-only variant of\n  the Unit Test Framework. Defaults to OFF.\n\n### Thread\n\n* `BOOST_THREAD_THREADAPI`\n\n  Threading API, `pthread` or `win32`. Defaults to `win32` under Windows,\n  `pthread` otherwise.\n\n## Testing Boost with CMake\n\nTo run the Boost tests with CMake/CTest, first configure as before, but with\n`BUILD_TESTING=ON`:\n\n```\nmkdir __build\ncd __build\ncmake -DBUILD_TESTING=ON ..\n```\n\nthen build the tests:\n\n```\ncmake --build . --target tests\n```\n\nand then run them:\n\n```\nctest --output-on-failure --no-tests=error\n```\n\nUnder Windows, you need to select a configuration (Debug or Release):\n\n```\ncmake --build . --target tests --config Debug\nctest --output-on-failure --no-tests=error -C Debug\n```\n\nTo only build the tests for a specific library, and not the entire Boost,\nuse `BOOST_INCLUDE_LIBRARIES`:\n\n```\ncmake -DBUILD_TESTING=ON -DBOOST_INCLUDE_LIBRARIES=timer ..\n```\n\nTo build and run in parallel using more than one core, use the `-j`\noption:\n\n```\ncmake --build . --target tests -j 16\nctest --output-on-failure --no-tests=error -j 16\n```\n\nA convenience target `check` is provided that first builds the tests and\nthen invokes `ctest`:\n\n```\ncmake --build . --target check\n```\n\nbut it doesn't support running the tests in parallel.\n\n## Using Boost after building and installing it with CMake\n\nNormally, a Boost installation is used from CMake by means of\n`find_package(Boost)`. However, up to and including release 1.81.0, installing\nBoost with CMake did not deploy the necessary CMake configuration file for\nthe `Boost` package, so `find_package(Boost)` did not work. (It also did\nnot provide the `Boost::boost` and `Boost::headers` targets, on which many\nexisting `CMakeLists.txt` files rely.)\n\nInstead, the individual Boost libraries needed to be referenced as in\n```cmake\nfind_package(boost_filesystem 1.81 REQUIRED)\n```\n\nThis has been rectified in Boost 1.82, which installs an umbrella CMake\nconfiguration file for the Boost package (`BoostConfig.cmake`) and\nprovides the `Boost::boost` and `Boost::headers` compatibility targets.\n\n## Using Boost with `add_subdirectory`\n\nAssuming that your project already has a copy of Boost in a subdirectory,\neither deployed as a Git submodule or extracted manually by the user as a\nprerequisite, using it is relatively straightforward:\n\n```cmake\nadd_subdirectory(deps/boost)\n```\n\nHowever, as-is, this will configure all Boost libraries and build them by\ndefault regardless of whether they are used. It's better to use\n\n```cmake\nadd_subdirectory(deps/boost EXCLUDE_FROM_ALL)\n```\n\nso that only the libraries that are referenced by the project are built,\nand it's even better to set `BOOST_INCLUDE_LIBRARIES` before the\n`add_subdirectory` call to a list of the Boost libraries that need to be\nconfigured:\n\n```cmake\nset(BOOST_INCLUDE_LIBRARIES filesystem regex)\nadd_subdirectory(deps/boost EXCLUDE_FROM_ALL)\n```\n\n## Using an individual Boost library with `add_subdirectory`\n\nBoost is a large dependency, and sometimes a project only needs a single\nlibrary. It's possible to use `add_subdirectory` with individual Boost\nlibraries (`https://github.com/boostorg/\u003clibname\u003e`) instead of the entire\nsuperproject or release archive. However, since Boost libraries depend on\neach other quite extensively, all library dependencies also need to be\nadded (again via `add_subdirectory`.)\n\nAs an example, this is how one would use Boost.Timer in this manner:\n\n```cmake\nset(libs\n\n  timer\n\n  # Primary dependencies\n\n  chrono\n  config\n  core\n  io\n  predef\n  system\n  throw_exception\n\n  # Secondary dependencies\n\n  assert\n  integer\n  move\n  mpl\n  ratio\n  static_assert\n  type_traits\n  typeof\n  utility\n  winapi\n  variant2\n  preprocessor\n  rational\n  mp11\n)\n\nforeach(lib IN LISTS libs)\n\n  add_subdirectory(deps/boost/${lib} EXCLUDE_FROM_ALL)\n\nendforeach()\n```\n\nassuming that the individual libraries have been placed in subdirectories\nof `deps/boost`.\n\n(The list of required dependencies above has been produced by running\n`boostdep --brief timer`. See\n[the documentation of Boostdep](https://boost.org/tools/boostdep).)\n\n## Using Boost with `FetchContent`\n\n`FetchContent` downloads the required dependencies as part of CMake's\nproject configuration phase. While this is convenient because it doesn't\nrequire the user to acquire the dependencies beforehand, in the case of\nBoost it involves an 87 MB download, so you should carefully weigh the\npros and cons of this approach.\n\nThat said, here's how one would use Boost with `FetchContent`:\n\n```cmake\ninclude(FetchContent)\n\nFetchContent_Declare(\n  Boost\n  URL https://github.com/boostorg/boost/releases/download/boost-1.84.0/boost-1.84.0.tar.xz\n  URL_MD5 893b5203b862eb9bbd08553e24ff146a\n  DOWNLOAD_EXTRACT_TIMESTAMP ON\n)\n\nFetchContent_MakeAvailable(Boost)\n```\n\nThis has the same drawback as the simple `add_subdirectory` call -- all\nBoost libraries are configured and built, even if not used by the project.\n\nTo configure only some Boost libraries, set `BOOST_INCLUDE_LIBRARIES`\nbefore the `FetchContent_MakeAvailable` call:\n\n```cmake\nset(BOOST_INCLUDE_LIBRARIES timer filesystem regex)\nFetchContent_MakeAvailable(Boost)\n```\n\nTo perform the `add_subdirectory` call with the `EXCLUDE_FROM_ALL` option, if you\nare using CMake 3.28 or newer, you can simply pass `EXCLUDE_FROM_ALL` to\n`FetchContent_Declare`:\n\n```cmake\nFetchContent_Declare(\n  Boost\n  URL https://github.com/boostorg/boost/releases/download/boost-1.84.0/boost-1.84.0.tar.xz\n  URL_MD5 893b5203b862eb9bbd08553e24ff146a\n  DOWNLOAD_EXTRACT_TIMESTAMP ON\n  EXCLUDE_FROM_ALL\n)\n```\n\nFor earlier versions of CMake, you can replace `FetchContent_MakeAvailable(Boost)` with this:\n\n```cmake\nFetchContent_GetProperties(Boost)\n\nif(NOT Boost_POPULATED)\n\n  message(STATUS \"Fetching Boost\")\n  FetchContent_Populate(Boost)\n\n  message(STATUS \"Configuring Boost\")\n  add_subdirectory(${Boost_SOURCE_DIR} ${Boost_BINARY_DIR} EXCLUDE_FROM_ALL)\n\nendif()\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fboostorg%2Fcmake","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fboostorg%2Fcmake","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fboostorg%2Fcmake/lists"}