我发现了android_cmake和boost的奇怪行为。我使用
开始使用cmakecmake ../ -DCMAKE_TOOLCHAIN_FILE=/opt/android/android-cmake/android.toolchain.cmake -DBOOST_ROOT=/opt/android/android-cmake/common-libs/boost -DBOOST_INCLUDEDIR=/opt/android/android-cmake/common-libs/boost/boost-trunk/boost -DBOOST_LIBRARYDIR=/opt/android/android-cmake/common-libs/boost/libs/armeabi-v7a -DBoost_DEBUG=1
如您所见,设置了所有3个boost变量BOOST_ROOT,BOOST_INCLUDEDIR和BOOST_LIBRARYDIR。通过“find_host_package”函数找到提升。下面是输出的一部分:
-- [ /opt/sw/cmake-2.8.10.2/share/cmake-2.8/Modules/FindBoost.cmake:646 ] BOOST_ROOT = /opt/android/android-cmake/common-libs/boost
-- [ /opt/sw/cmake-2.8.10.2/share/cmake-2.8/Modules/FindBoost.cmake:648 ] BOOST_INCLUDEDIR = /opt/android/android-cmake/common-libs/boost/boost-trunk/boost
-- [ /opt/sw/cmake-2.8.10.2/share/cmake-2.8/Modules/FindBoost.cmake:650 ] BOOST_LIBRARYDIR = /opt/android/android-cmake/common-libs/boost/libs/armeabi-v7a
-- [ /opt/sw/cmake-2.8.10.2/share/cmake-2.8/Modules/FindBoost.cmake:705 ] Include debugging info:
-- [ /opt/sw/cmake-2.8.10.2/share/cmake-2.8/Modules/FindBoost.cmake:707 ] _boost_INCLUDE_SEARCH_DIRS = /opt/android/android-cmake/common-libs/boost/boost-trunk/boost;/opt/android/android-cmake/common-libs/boost/include;/opt/android/android-cmake/common-libs/boost;C:/boost/include;C:/boost;/boost/include;/boost;/sw/local/include
-- [ /opt/sw/cmake-2.8.10.2/share/cmake-2.8/Modules/FindBoost.cmake:734 ] location of version.hpp: /usr/local/include/boost/version.hpp
正如您所看到的,提升版本不是来自设置位置,而是来自
/usr/local/include/boost/version.hpp
即使我指定的位置 包含version.hpp:
/opt/android/android-cmake/common-libs/boost/boost-trunk/boost/version.hpp
现在我无法确定发生了什么以及cmake在哪些方面取得了进展......有什么建议吗?
答案 0 :(得分:0)
您可能需要强行排除默认搜索
Boost_NO_SYSTEM_PATHS - 设置为ON以禁用在位置搜索 这些提示变量没有指定。默认为OFF。
http://www.cmake.org/cmake/help/git-master/module/FindBoost.html
尝试,
cmake ../ -DCMAKE_TOOLCHAIN_FILE=/opt/android/android-cmake/android.toolchain.cmake -DBOOST_ROOT=/opt/android/android-cmake/common-libs/boost -DBOOST_INCLUDEDIR=/opt/android/android-cmake/common-libs/boost/boost-trunk/boost -DBOOST_LIBRARYDIR=/opt/android/android-cmake/common-libs/boost/libs/armeabi-v7a -DBoost_DEBUG=1 -DBoost_NO_SYSTEM_PATHS=ON