Finding Magnification Using CMake
Let me start by saying that getting CMake to find Boost can be difficult, because the machine in FindBoost.cmake will bite you, and the KitWare creators of CMake have some of the worst documents of any popular project I have ever encountered. You will have to go through the FindBoost.cmake source to debug it if it doesn't work.
Cross-compiled increase
The directory that you installed using crossed addition looks like this: 1.62.0
boost-arm-build/include boost-arm-build/include/boost-1_62 boost-arm-build/lib
Call CMake from the Project-Build directory
cmake \ -DBoost_NO_SYSTEM_PATHS=TRUE \ -DBoost_ADDITIONAL_VERSIONS="1.62" \ -DCMAKE_TOOLCHAIN_FILE=../android.toolchain \ -DBOOST_ROOT="../boost-arm-build" \ ../Project/
-DBoost_ADDITIONAL_VERSIONS - CMake searches for Boost using a hard-copy list of strings, if your CMake is older than the version of Boost you are building, will not know where to look in the include directory, so you will need to go through this together. Although the version is actually 1.62.0, boost adds to boost-1_62, so I use 1.62 instead. In FindBoost.cmake you will find that each version is added twice, as in "1.62.0" "1.62" for this very reason.
You should also check the file names of the libraries you created, in my example, consider system :
libboost_system-gcc-mt-1_62.a libboost_system-gcc-mt-1_62.so # Symbolic link to libboost_system-gcc-mt-1_62.so.1.62.0 libboost_system-gcc-mt-1_62.so.1.62.0 libboost_system-gcc-mt-d-1_62.a libboost_system-gcc-mt-d-1_62.so # Symbolic link to libboost_system-gcc-mt-d-1_62.so.1.62.0 libboost_system-gcc-mt-d-1_62.so.1.62.0
gcc - used compilermt - multithreadedd - debug1_62 - boost version, obviously
If you see libboost_system.a, it means that you were not able to create boost with --with-layout=versioned and probably should check my SO answer for building building with NDK . If you see clang instead of gcc , itβs great that you created boost with clang, but you probably need to tell CMake that clang exists using the Boost_COMPILER flag.
-DBoost_COMPILER="-clang"
Android.toolchain file
set(CMAKE_SYSTEM_NAME Android) set(CROSS_COMPILER_DIR /opt/ndk-R13-standalone) set(CMAKE_C_COMPILER ${CROSS_COMPILER_DIR}/bin/arm-linux-androideabi-gcc) set(CMAKE_CXX_COMPILER ${CROSS_COMPILER_DIR}/bin/arm-linux-androideabi-g++) set(ANDROID_NATIVE_API_LEVEL android-19) set(ANDROID_ABI armeabi-v7a) set(ANDROID_STL gnustl_static) set(CMAKE_SYSROOT ${CROSS_COMPILER_DIR}/sysroot) set(CMAKE_FIND_ROOT_PATH ${CMAKE_SYSROOT})