I am trying to build a native Android project that requires Boost library. I have built Boost for the platforms I am targeting using this git project. But for some reason find_package() for Boost fails to find the Boost header paths
Below is the project structure and for the Android app, and location where I have placed the Boost library.
android_app
├── src
│ └──<folder>
│ └──<folder>
│ └──CMakeLists.txt
└── lib
└── boost_armeabi-v7a
├── include
│ └── boost_1_68_0
│ └──boost
│ ├──align.hpp
│ ├──......
│ └──config.hpp
└── lib
├──libboost_atomic.a
├──......
└──libboost_wserialization.a
In the CMake file I have configured like this
set(Boost_NO_SYSTEM_PATHS ON)
set(Boost_NO_BOOST_CMAKE ON)
set(LOCAL_LIB_DIR "${PROJECT_SOURCE_DIR}/../../../lib")
set(Boost_ADDITIONAL_VERSIONS "1.68.0")
set(BOOST_INCLUDEDIR "${LOCAL_LIB_DIR}/boost_${ANDROID_ABI}/include")
set(BOOST_LIBRARYDIR "${LOCAL_LIB_DIR}/boost_${ANDROID_ABI}/lib")
find_package(Boost REQUIRED)
Below error is the error iam getting with find_package
.
Unable to find the Boost header files. Please set BOOST_ROOT to the root
directory containing Boost or BOOST_INCLUDEDIR to the directory containing Boost's headers.
I added some message statements and finally narrowed down to this piece of code in the FindBoost CMake file (3.10.2) installed from Android Studio
find_path(Boost_INCLUDE_DIR
NAMES boost/config.hpp
HINTS ${_boost_INCLUDE_SEARCH_DIRS}
PATH_SUFFIXES ${_boost_PATH_SUFFIXES}
)
Dumping there variables, one of the combination for {_boost_INCLUDE_SEARCH_DIRS}/{_boost_PATH_SUFFIXES}
should be valid for my path, but after this executes, Boost_INCLUDE_DIR
is set as NOTFOUND
. I have no idea why this fails.
One of the _boost_INCLUDE_SEARCH_DIRS
value is /home/<user>/<path-to-repo>/app/lib/boost_armeabi-v7a/include
and one of value in PATH_SUFFIXES
is boost_1_68_0
. Can some one help me figure out why this is failing?