CPM.cmake
                                
                                
                                
                                    CPM.cmake copied to clipboard
                            
                            
                            
                        Please add a working example with boost test
Somehow I am not able to get boost test working with cpm.cmake. I have used the snippet for boost libraries, used cache but neither the include nor libraries are found.
Following is something that is currently working for me (taken from this another issue)
  set(Boost_USE_STATIC_LIBS ON)
  set(Boost_USE_MULTITHREADED ON)
  set(Boost_USE_STATIC_RUNTIME OFF)
  CPMAddPackage(
    NAME Boost
    VERSION 1.79.0
    GITHUB_REPOSITORY "boostorg/boost"
    GIT_TAG "boost-1.79.0"
  )
  if(Boost_ADDED)
      message("boost asio downloaded at " ${Boost_SOURCE_DIR}/libs/asio/include)
      file(GLOB files "${Boost_SOURCE_DIR}/libs/*/include")
      foreach(filename ${files})
          include_directories(${filename})
      endforeach()
      file(GLOB files "${Boost_SOURCE_DIR}/libs/*/*/include")
      foreach(filename ${files})
          include_directories(${filename})
      endforeach()
  endif()
Is this the correct way? Can this be properly documented in examples?
You shouldn't use include_directories in modern cmake but rather create a target and use target_include_directories
Did you took a look at boost-cmake ?
@OlivierLDff , I am not using include_directories in my actual targets, but what target should I specify for things that are added by CPMAddPackage? I want to use CPMAddPackage for all external dependencies and don't want to bother separate solutions like boost-make.
Seems that boost still has poor CMake support. See #359 for our rollback to boost-cmake.
If you only need asio,  you may try this:
https://github.com/chriskohlhoff/asio/pull/1105
It is much faster to fetch and is an interface library.
done, see https://github.com/cpm-cmake/CPM.cmake/pull/359/commits/7db2d511ae4c4228a0620ce58872990c460386c3
done, see 7db2d51
Thanks @ClausKlein , where is the part to download boost? I am not able to see top level CMakeLists.txt where this code might be.
https://github.com/cpm-cmake/CPM.cmake/blob/7db2d511ae4c4228a0620ce58872990c460386c3/examples/boost/CMakeLists.txt