Skip to content

Cannot find some headers #45

Open
Open
@lproj

Description

@lproj

Hi,

I am trying to install boost v1.83.0 with CPM.cmake, but some headers like the ones in <boost/accumulators/[...]> cannot be found in the standard path during build. Can you tell me why and/or help me please?

Below are a simple CMakeLists.txt and a simple program reproducing the problem (also with boost 1.82.0...):

# CMakeLists.txt
add_executable(CPMExampleBoost main.cpp)
target_compile_features(CPMExampleBoost PRIVATE cxx_std_17)

file(
  DOWNLOAD
  https://github.com/cpm-cmake/CPM.cmake/releases/download/v0.38.3/CPM.cmake
  ${CMAKE_CURRENT_BINARY_DIR}/cmake/CPM.cmake
  EXPECTED_HASH SHA256=cc155ce02e7945e7b8967ddfaff0b050e958a723ef7aad3766d368940cb15494
)
include(${CMAKE_CURRENT_BINARY_DIR}/cmake/CPM.cmake)

set(Boost_DEBUG ON)

CPMAddPackage(
  NAME Boost
  VERSION 1.83.0
  GITHUB_REPOSITORY "boostorg/boost"
  GIT_TAG "boost-1.83.0"
)

target_link_libraries(CPMExampleBoost PRIVATE Boost::headers)
// Taken from https://www.boost.org/doc/libs/1_83_0/doc/html/accumulators/user_s_guide.html

#include <boost/accumulators/accumulators.hpp>
#include <boost/accumulators/statistics/mean.hpp>
#include <boost/accumulators/statistics/moment.hpp>
#include <boost/accumulators/statistics/stats.hpp>
#include <iostream>
using namespace boost::accumulators;

int main() {
  accumulator_set<double, stats<tag::mean, tag::moment<2>>> acc;

  acc(1.2);
  acc(2.3);
  acc(3.4);
  acc(4.5);

  std::cout << "Mean:   " << mean(acc) << std::endl;
  std::cout << "Moment: " << moment<2>(acc) << std::endl;
}

main.cpp:4:10: fatal error: boost/accumulators/accumulators.hpp: No such file or directory
4 | #include <boost/accumulators/accumulators.hpp>

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions