Skip to content

[FR] push/pop required policies in cmake toolchain file #2032

Closed
@andreya108

Description

@andreya108

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

Metadata

Metadata

Assignees

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions