I guess the only feedback I really would like is if the path normalization I'm doing for CMAKE_ANDROID_NDK is necessary (converting backslashes to forward slashes). Will CMake translate the backslashes properly?
Sometimes I use CMAKE_ANDROID_NDK in custom commands and custom targets to build absolute paths to items in the NDK. On Tue, Apr 18, 2017 at 9:45 PM, Robert Dailey <rcdailey.li...@gmail.com> wrote: > I'm trying to follow best practices where I can, but the trouble is > I'm not aware of any. So I want to post my android.toolchain.cmake > file here, with the hope that I can get some pointers. > > The main thing I want to understand is when it is appropriate to > require cache variables be set via command line argument (-D) or via > the toolchain file itself. Here is what is in my toolchain right now: > > > set(CMAKE_SYSTEM_NAME Android) > set(CMAKE_SYSTEM_VERSION 15) # API level > set(CMAKE_ANDROID_ARCH_ABI armeabi-v7a) > set(CMAKE_ANDROID_STL_TYPE c++_static) > set(CMAKE_ANDROID_NDK_TOOLCHAIN_VERSION clang) > > string(REGEX REPLACE "\\\\" "/" ndk_path "$ENV{ANDROID_NDK}") > set(CMAKE_ANDROID_NDK ${ndk_path}) > > unset(ndk_path) > > > > My idea here is to provide a different toolchain file per specific NDK > configuration. For example, I need to build my native libraries for > both x86 and ARM platforms, so I would use 2 CMAKE_BINARY_DIR, each > configured using a different toolchain: > > x86 would use "android.toolchain.x86.cmake" > ARM would use "android.toolchain.arm.cmake" > > Something like that. Is this best practice? What other advice would you offer? > > Thanks in advance. -- 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