Versions tested: from 1.79.0 upto 1.88.0.beta1 .
AddBoost.cmake
via CPM: (or install AddBoost.cmake system-wide, check Features section of the document)set(AddBoost.cmake_VERSION 3.7.3) CPMAddPackage( NAME AddBoost.cmake VERSION "${AddBoost.cmake_VERSION}" URL "https://github.com/Arniiiii/AddBoost.cmake/archive/refs/tags/${AddBoost.cmake_VERSION}.tar.gz" )
add_boost
macro. Notice NOT wrapping variables like TRY_BOOST_VERSION and so on in "${}"
when sending arguments to the macroset(TRY_BOOST_VERSION "1.88.0.beta1") set(BOOST_MY_OPTIONS "BOOST_ENABLE_PYTHON ON;") set(BOOST_NOT_HEADER_ONLY_COMPONENTS_THAT_YOU_NEED "thread;system") set(BOOST_HEADER_ONLY_COMPONENTS_THAT_YOU_NEED "asio;beast;uuid;container;cobalt") add_boost( TRY_BOOST_VERSION BOOST_HEADER_ONLY_COMPONENTS_THAT_YOU_NEED BOOST_NOT_HEADER_ONLY_COMPONENTS_THAT_YOU_NEED your_target_name your_target_name2 your_target_name... )
${ADDBOOSTCMAKE_PACKAGEPROJECT_INSTALL_TARGETS}
): (Assumed that your target is named ${PROJECT_NAME}
)string(TOLOWER ${PROJECT_NAME}/version.h VERSION_HEADER_LOCATION) string(TOLOWER ${PROJECT_NAME}/export.h EXPORT_HEADER_LOCATION) set_property(TARGET ${PROJECT_NAME} PROPERTY VERSION ${PROJECT_VERSION}) set_property(TARGET ${PROJECT_NAME} PROPERTY SOVERSION ${PROJECT_VERSION}) CPMAddPackage( NAME PackageProject.cmake VERSION 1.12.0 GITHUB_REPOSITORY "TheLartians/PackageProject.cmake" ) packageProject( NAME ${PROJECT_NAME} VERSION ${PROJECT_VERSION} NAMESPACE ${PROJECT_NAME} BINARY_DIR ${PROJECT_BINARY_DIR} INCLUDE_DIR ${PROJECT_SOURCE_DIR}/include INCLUDE_DESTINATION include/${PROJECT_NAME} VERSION_HEADER "${VERSION_HEADER_LOCATION}" EXPORT_HEADER "${EXPORT_HEADER_LOCATION}" COMPATIBILITY "AnyNewerVersion" DISABLE_VERSION_SUFFIX ON DEPENDENCIES "${ADDBOOSTCMAKE_PACKAGEPROJECT_INSTALL_TARGETS}" )
-DCPM_USE_LOCAL_PACKAGES=1
for "looking for local Boost. if failed: download" mode. Set -DCPM_LOCAL_PACKAGES_ONLY=1
to only look for installed Boost and emit error if failed to find)-DCPM_USE_LOCAL_PACKAGES=1
and there's installed Boost with lower version than needed or if installed Boost doesn't exist on the system or if -DCPM_DOWNLOAD_ALL=1
is set.build
folder and going to reconfigure), set -DCPM_SOURCE_CACHE=./.cache/cpm
or something like.PackageProject.cmake
add_boost(...)
or by setting BOOST_MY_OPTIONS
to something like "OPTION value;OPTION2 value;"
for example BOOST_ENABLE_PYTHON ON;
.BOOST_USE_MY_BOOST_DIRECTORY
to be the path with your Boost before calling the function macro add_boost(...)
.add_boost(...)
macro.ADDBOOSTCMAKE_LINK_TYPE
to override default behaviour of linking: if target is INTERFACE, use INTERFACE, if else: PUBLICboost-1.88.0.beta1
, since find_package
considers such version as incorrect, but we understand what you mean ^_^-DAddBoost.cmake_INSTALL=ON
command line option at configuring and install as a usual CMake package. And yes, it supports versioning! find_package(AddBoost.cmake 3.7.2)
find_package(Boost ${VERSION} ${COMPONENTS})
. Therefore, set version of Boost you need so that it have the library.-DCPM_USE_LOCAL_PACKAGES=1
. Temporary solution: -DCPN_LOCAL_PACKAGES_ONLY=1
will show the reason, but it has a problem too: it will make all CPM to only find packages, not add. But it works, trust me.-DCPM_SOURCE_CACHE=/path/to/a/folder/for/downloaded/sources/
. On Linux, you may use ~/.cache/cpm
(per user) , ./.cache/cpm
(per work folder) or whatever else.add_boost(...)
, define variable BOOST_ADD_MY_PATCHES
to be a path to folder in which there's *.patch
in such layout:patches/
└── boost
├── 1.80.0
│ ├── a.patch
│ └── b.patch
├── 1.80.0.beta1
│ └── c.patch
├── 1.81.0
│ └── d.patch
├── 1.81.0.beta1
│ └── d.patch
├── 1.82.0
│ └── e.patch
├── 1.83.0
│ └── f.patch
├── 1.84.0
│ └── g.patch
├── patch_for_all_versions1.patch
└── i_dont_care_to_what_boost_version_itll_apply.patch
Where in folder with specific version will be patches, that will apply only to this version, if it's specified.
MIT
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4