On 03/12/2016 04:05 AM, Xiaolei Yu wrote: > my team decided to ditch ndk-build and migrate to cmake. And I would > like to upstream these two modules, which are currently used in my hobby > projects.
Thanks. Yes, code to search for the Android NDK or a standalone toolchain belongs in CMake upstream rather than in the toolchain file. However, it should not have to be a separate find_package(AndroidNDK) step. The right place is likely in a Modules/Platform/Android-Initialize.cmake file similar to the Modules/Platform/Darwin-Initialize.cmake file already used to find the OS X SDK. The Android-Initialize file will be loaded automatically when a toolchain file sets CMAKE_SYSTEM_NAME to Android. I've long wished to see work along these lines done, but it is not trivial. The selection of STL, ARCH, etc. all need to be presented cleanly as options to the user as cache entries with reasonable defaults. It all needs to be done as part of the Android platform information modules and not activated by any explicit code in the project. I'm not sure how it should properly mix with selection of the actual toolchain (compiler). In particular, selecting the STL may need some additional changes on the C++ side of the CMake implementation. Instead of code like > include_directories ( SYSTEM > ${_gnustl}/libs/${CMAKE_LIBRARY_ARCHITECTURE}/include > ${_gnustl}/include > ) we need an equivalent to CMAKE_CXX_STANDARD_LIBRARIES for system include directories that come from the SDK. > 1. using CMAKE_LIBRARY_ARCHITECTURE to represent android > TARGET_ARCH_ABI. CMAKE_LIBRARY_ARCHITECTURE affects the find_* logic and I do not think it should be overloaded with additional meanings. A simple CMAKE_ANDROID_ARCH cache entry in the Android-Initialize module discussed above may be sufficient. Thanks, -Brad -- Powered by www.kitware.com Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Kitware offers various services to support the CMake community. For more information on each offering, please visit: CMake Support: http://cmake.org/cmake/help/support.html CMake Consulting: http://cmake.org/cmake/help/consulting.html CMake Training Courses: http://cmake.org/cmake/help/training.html Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Follow this link to subscribe/unsubscribe: http://public.kitware.com/mailman/listinfo/cmake-developers