Skip to content

Instantly share code, notes, and snippets.

@freol35241
Last active October 25, 2024 22:10
Show Gist options
  • Save freol35241/046ea1c018f4a59db456bc64bbc6aebd to your computer and use it in GitHub Desktop.
Save freol35241/046ea1c018f4a59db456bc64bbc6aebd to your computer and use it in GitHub Desktop.
CPM.cmake + Boost (header libs only)
CPMAddPackage(
NAME Boost
VERSION 1.76.0
URL https://boostorg.jfrog.io/artifactory/main/release/1.76.0/source/boost_1_76_0.tar.gz
DOWNLOAD_ONLY True
)
if(Boost_ADDED)
# Define the header-only Boost target
add_library(Boost::boost INTERFACE IMPORTED GLOBAL)
target_include_directories(Boost::boost SYSTEM INTERFACE ${Boost_SOURCE_DIR})
# Disable autolink
target_compile_definitions(Boost::boost INTERFACE BOOST_ALL_NO_LIB=1)
endif()
# target_link_libraries(your_project Boost::boost)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment