ndk icon indicating copy to clipboard operation
ndk copied to clipboard

[FR] warn user if their cmake_minimum_required setting is incompatible with android

Open andreya108 opened this issue 1 year ago • 4 comments

Description

Trying to build project with new NDK we got the following for each component:

-- The C compiler identification is Clang 18.0.1
-- The CXX compiler identification is Clang 18.0.1
CMake Error at /home/andrey/android-sdk-linux/ndk/27.0.11902837/build/cmake/flags.cmake:50 (if):
  if given arguments:

    "hwaddress" "IN_LIST" "ANDROID_SANITIZE"

  Unknown arguments specified
Call Stack (most recent call first):
  /snap/cmake/1399/share/cmake-3.29/Modules/Platform/Android-Clang.cmake:23 (include)
  /snap/cmake/1399/share/cmake-3.29/Modules/Platform/Android-Clang-C.cmake:1 (include)
  /snap/cmake/1399/share/cmake-3.29/Modules/CMakeCInformation.cmake:48 (include)
  CMakeLists.txt:3 (project)


-- Configuring incomplete, errors occurred!

Adding

if(POLICY CMP0057)                                                                                                                                                          
  cmake_policy(SET CMP0057 NEW)
endif()

to the beginning of file ndk/27.0.11902837/build/cmake/flags.cmake solves the problem.

Why it is not set there (https://android.googlesource.com/platform/ndk/+/refs/heads/main/build/cmake/flags.cmake) by default?

P.S.: using $ANDROID_SDK/cmake/3.22.1 gives the same result

Affected versions

r27

Canary version

No response

Host OS

Linux

Host OS version

Ubuntu 20.04

Affected ABIs

arm64-v8a

Build system

CMake

Other build system

No response

minSdkVersion

26

Device API level

No response

andreya108 avatar Jun 20 '24 09:06 andreya108