CMake无法找到boost_test

时间:2019-05-14 23:03:08

标签: c++ boost cmake

在OSX上,我已经使用brew install boost安装了Boost,并且我尝试按如下所示进行链接:

cmake_minimum_required(VERSION 3.13)
project(LinkBoost)

set(CMAKE_CXX_STANDARD 14)

add_executable(LinkBoost
    desmond.cpp
    desmond.h
    integration.cpp
    integration.h
    main.cpp
    main.h
    utillity.cpp
    utillity.h)

list(APPEND CMAKE_PREFIX_PATH "/usr/local/Cellar/boost/1.69.0_2")
set(Boost_ADDITIONAL_VERSIONS "1.69.0" "1.69")

find_package(BoostCOMPONENTS filesystem system test REQUIRED)

target_include_directories(LinkBoost PUBLIC ".")

# adds include directories, definitions and link libraries
target_link_libraries(VelocityDispersion PUBLIC
        Boost::filesystem Boost::system Boost::test)

这给了我

Unable to find the requested Boost libraries.

Boost version: 1.69.0

Boost include path: /usr/local/Cellar/boost/1.69.0_2/include

Could not find the following Boost libraries:

      boost_test

Some (but not all) of the required Boost libraries were found.  You may
need to install these additional Boost libraries.  Alternatively, set
BOOST_LIBRARYDIR to the directory containing Boost libraries or BOOST_ROOT
to the location of Boost.

有人可以帮助我了解这里出了什么问题吗?我觉得很明显我很想念...

1 个答案:

答案 0 :(得分:0)

我已经设法使其与以下内容类似:

tar_list = ['tar_4', 'tar_3', 'tar_2', 'tar_1']
cols = [col for col in df.columns if col not in tar_list]
# since your dataframe may not have continuous index
idx = df.index

for tar in tar_list:
    medians = df[cols].groupby(by = df[tar]).agg('median')
    df.set_index(tar, inplace=True)
    for col in cols:
        df[col] = df[col].fillna(medians[col])
    df.reset_index(inplace=True)

df.index = idx

但是我认为问题的很大一部分是我对Boost测试的工作原理有基本的了解-我鼓励在这里苦苦挣扎的人阅读Boost的文档。