conan-io / conan

Conan - The open-source C and C++ package manager
https://conan.io
MIT License
8.29k stars 985 forks source link

[bug] NDK path with spaces doesn't work in CMakeToolchain #17378

Closed kambala-decapitator closed 1 hour ago

kambala-decapitator commented 2 hours ago

Describe the bug

macOS 14.7, Conan v2.9.2

If NDK path contains spaces, then it's inserted in the toolchain file as is and cmake doesn't like it of course. Example:

conan install -c tools.android:ndk_path=/Volumes/Android\ NDK\ r27c/AndroidNDK12479018.app/Contents/NDK ...

then at cmake configure time there'll be error like:

CMake Error at conan-android64-25/conan_toolchain.cmake:39 (include):
  include called with invalid argument:
  r27c/AndroidNDK12479018.app/Contents/NDK/build/cmake/android.toolchain.cmake
Call Stack (most recent call first):
  /Users/kambala/dev/vcmi/build-android64/CMakeFiles/3.31.0/CMakeSystem.cmake:6 (include)
  CMakeLists.txt:6 (project)

Embedding quotes inside the path also doesn't help:

conan install -c tools.android:ndk_path='"/Volumes/Android NDK r27c/AndroidNDK12479018.app/Contents/NDK"' ...
...
CMake Error at conan-android64-25/conan_toolchain.cmake:39 (include):
  include requested file is a directory:

    /Volumes/Android NDK r27c/AndroidNDK12479018.app/Contents/NDK
Call Stack (most recent call first):
  /Users/kambala/dev/vcmi/build-android64/CMakeFiles/3.31.0/CMakeSystem.cmake:6 (include)
  CMakeLists.txt:6 (project)

Adding the config to a profile instead results in exactly the same issues.

How to reproduce it

pass -c tools.android:ndk_path='/some/path with spaces' to conan install and check the generated toolchain file or try to configure a CMake project with it

kambala-decapitator commented 2 hours ago

opened #17379 to fix it