FindBoost 总是失败

问题描述 投票:0回答:1

我安装了 Boost

sudo apt-get install libboost-all-dev

我还尝试按照此处的文档构建并将其安装到自定义位置,然后在nano ~/.bashrc中的环境变量中添加路径:

## BOOST
export BOOST_ROOT=/home/user/Downloads/boost_1_66_0
export BOOST_INCLUDE_DIR=${BOOST_ROOT}
export BOOST_LIBRARYDIR=${BOOST_ROOT}/stage/lib  

这些都不起作用。当我尝试使用

cd android && ./gradlew clean && cd ../
构建应用程序时,出现以下错误:

Could NOT find Boost (missing: Boost_INCLUDE_DIR)

这就是 Boost 设置在 CMakeLists.txt 中的样子:

set(Boost_USE_STATIC_LIBS OFF) 
set(Boost_USE_MULTITHREADED ON)  
set(Boost_USE_STATIC_RUNTIME OFF) 

find_package(Boost 1.45.0 COMPONENTS filesystem) 

if(Boost_FOUND)
    include_directories(${Boost_INCLUDE_DIRS}) 
    add_executable(progname file1.cxx file2.cxx) 
    target_link_libraries(progname ${Boost_LIBRARIES})
endif()

我错过了什么?我该如何修复它并使其正常工作?

提前谢谢大家。

android c++ ubuntu boost cmake
1个回答
0
投票

在 Android 和 android Studio 中使用 Boost 的详细说明位于:

https://stackoverflow.com/a/77662372/1756939

解释如何高效调试 findboost.cmake 脚本。

© www.soinside.com 2019 - 2024. All rights reserved.