here's another one trying to use boost with android (and possibly writing a portable cmakelists file).
The problem:
find_path appends the HINTS to an ndk path instead of using them as absolute path:
minimal reproducible example:
add on a cmakelists.txt the following:
set(CMAKE_FIND_DEBUG_MODE TRUE)
find_path(ABC_VAR
NAMES a_random_existing_file.txt
HINTS the_abs_path_of_the_file
)
output on console similar to:
find_path called with the following settings:
VAR: Boost_INCLUDE_DIR
NAMES: "boost/config.hpp"
Documentation: Path to a file.
Framework
Only Search Frameworks: 0
Search Frameworks Last: 0
Search Frameworks First: 1
AppBundle
Only Search AppBundle: 0
Search AppBundle Last: 0
Search AppBundle First: 1
CMAKE_FIND_USE_CMAKE_PATH: 0
CMAKE_FIND_USE_CMAKE_ENVIRONMENT_PATH: 0
CMAKE_FIND_USE_SYSTEM_ENVIRONMENT_PATH: 0
CMAKE_FIND_USE_CMAKE_SYSTEM_PATH: 0
find_path considered the following locations:
.....
/Users/bloom/Library/Android/sdk/ndk/25.1.8937393/the_abs_path_of_the_file/a_random_existing_file.txt
How do I get rid of "/Users/bloom/Library/Android/sdk/ndk/25.1.8937393/" part?
as a recap:
I cloned boost4android and compiled it (
https://github.com/moritz-wundke/Boost-for-Android)
I set the variables:
set(Boost_DEBUG ON)
set(BOOST_ROOT ${BOOST_PATH}/${CMAKE_ANDROID_ARCH_ABI})
set(BOOST_INCLUDEDIR ${BOOST_PATH}/${CMAKE_ANDROID_ARCH_ABI}/include/boost-1_82)
set(BOOST_LIBRARYDIR ${BOOST_PATH}/${CMAKE_ANDROID_ARCH_ABI}/lib)
set(Boost_LIB_PREFIX lib)
set(Boost_ADDITIONAL_VERSIONS "1.82.0" "1.82")
set(Boost_NO_SYSTEM_PATHS TRUE)
set(Boost_COMPILER "-clang-darwin")
set(Boost_USE_STATIC_LIBS ON)
set(Boost_USE_MULTITHREADED ON)
set(Boost_USE_STATIC_RUNTIME OFF)
find_package( Boost 1.82.0 COMPONENTS serialization )
and I'm stuck at that find_path not found.
---------------------------------------------------------------------------------------
Also set(Boost_DEBUG ON) doesn't print anything out of the box because in findBoost.cmake the instruction that prints contains an extra word STATUS.
message(STATUS "[ ${file}:${line} ] ${text}")
which sucks.
Who's gonna help this poor dev here? :D