How to detect target architecture using CMake?

后端 未结 8 1443
感情败类
感情败类 2020-12-08 02:17

I\'ve done a lot of research and been unable to find an answer to this... how can I reliably find the target architecture I\'m compiling for, using CMake? Basically, the equ

8条回答
  •  生来不讨喜
    2020-12-08 02:43

    Android ${ANDROID_ABI}

    The ${ANDROID_ABI} variable is the way to go in Android, where it assumes values like arm64-v8a, x86_64 and so on.

    It is used on the official NDK library example: https://github.com/googlesamples/android-ndk/blob/840858984e1bb8a7fab37c1b7c571efbe7d6eb75/hello-libs/app/src/main/cpp/CMakeLists.txt#L25

    I have further commented on that example at: NDK: How to include Prebuilt Shared Library Regardless of Architecture

提交回复
热议问题