Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrade cmake_minimum_required version for ndk r27? #5592

Closed
Galasnow opened this issue Jul 18, 2024 · 3 comments
Closed

Upgrade cmake_minimum_required version for ndk r27? #5592

Galasnow opened this issue Jul 18, 2024 · 3 comments

Comments

@Galasnow
Copy link
Contributor

detail | 详细描述 | 詳細な説明

When building ncnn for target "arm64-v8a" with Android ndk r27 (27.0.12077973), error occurs:

PS D:\ZYZ\ncnn_20240717\build_android_aarch64> cmake -G "Unix Makefiles" -DCMAKE_TOOLCHAIN_FILE=D:\Android\SDK\ndk\27.0.12077973/build/cmake/android.toolchain.cmake -DCMAKE_MAKE_PROGRAM="D:\Android\SDK\ndk\27.0.12077973/prebuilt/windows-x86_64/bin/make.exe" -DANDROID_ABI="arm64-v8a" -DANDROID_PLATFORM=android-29 -DNCNN_VULKAN=ON  ..
-- CMAKE_TOOLCHAIN_FILE = D:/Android/SDK/ndk/27.0.12077973/build/cmake/android.toolchain.cmake
-- CMAKE_INSTALL_PREFIX = D:/ZYZ/ncnn_20240717/build_android_aarch64/install
-- NCNN_VERSION_STRING = 1.0.20240718
CMake Deprecation Warning at CMakeLists.txt:24 (cmake_minimum_required):
  Compatibility with CMake < 3.5 will be removed from a future version of
  CMake.

  Update the VERSION argument <min> value or use a ...<max> suffix to tell
  CMake that the project does not need compatibility with older versions.


-- The C compiler identification is Clang 18.0.1
-- The CXX compiler identification is Clang 18.0.1
CMake Warning (dev) at D:/Android/SDK/ndk/27.0.12077973/build/cmake/flags.cmake:46 (if):
  Policy CMP0057 is not set: Support new IN_LIST if() operator.  Run "cmake
  --help-policy CMP0057" for policy details.  Use the cmake_policy command to
  set the policy and suppress this warning.

  IN_LIST will be interpreted as an operator when the policy is set to NEW.
  Since the policy is not set the OLD behavior will be used.
Call Stack (most recent call first):
  D:/cmake-3.30.0-windows-x86_64/share/cmake-3.30/Modules/Platform/Android-Clang.cmake:23 (include)
  D:/cmake-3.30.0-windows-x86_64/share/cmake-3.30/Modules/Platform/Android-Clang-C.cmake:1 (include)
  D:/cmake-3.30.0-windows-x86_64/share/cmake-3.30/Modules/CMakeCInformation.cmake:48 (include)
  CMakeLists.txt:39 (project)
This warning is for project developers.  Use -Wno-dev to suppress it.

CMake Error at D:/Android/SDK/ndk/27.0.12077973/build/cmake/flags.cmake:46 (if):
  if given arguments:

    "hwaddress" "IN_LIST" "ANDROID_SANITIZE"

  Unknown arguments specified
Call Stack (most recent call first):
  D:/cmake-3.30.0-windows-x86_64/share/cmake-3.30/Modules/Platform/Android-Clang.cmake:23 (include)
  D:/cmake-3.30.0-windows-x86_64/share/cmake-3.30/Modules/Platform/Android-Clang-C.cmake:1 (include)
  D:/cmake-3.30.0-windows-x86_64/share/cmake-3.30/Modules/CMakeCInformation.cmake:48 (include)
  CMakeLists.txt:39 (project)


-- Configuring incomplete, errors occurred!

It seems that upgrading cmake_minimum_required version to 3.3 or higher is the simplest solution, but I don't know exactly if this affects other targets or not.
Reference: android/ndk#2032

@Galasnow
Copy link
Contributor Author

I'm sorry that I didn't notice PR #1429. I wish cmake version have been upgraded on these embedded systems ):

@nihui
Copy link
Member

nihui commented Aug 5, 2024

cmake -DCMAKE_POLICY_DEFAULT_CMP0057=NEW -DCMAKE_TOOLCHAIN_FILE=XXXXX should work

@Galasnow
Copy link
Contributor Author

Galasnow commented Aug 5, 2024

It's an accurate solution. Should I modify the CMakeList.txt or the doc?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants