Skip to content

Ninja: Fix symlink failure on paths with spaces

Marcus Ong requested to merge ChaseOxide/cmake:master into master

Ninja generator does not quotes to paths with spaces for SONAME in CMAKE_SYMLINK_LIBRARY. This commit will add quotes to them.

I've tested the fix with https://gitlab.kitware.com/ChaseOxide/cmake-ninja-build-symlink on a Linux system.


Generated build.ninja before the fix:

...
build lib$ dir/libout2.so: CMAKE_SYMLINK_LIBRARY lib$ dir/libout2.so.1.0
  POST_BUILD = :
  SONAME = lib dir/libout2.so.1.0
...

Which will call cmake -E cmake_symlink_library 'lib dir/libout2.so.1.0' lib dir/libout2.so.1.0 'lib dir/libout2.so', and not surprisingly it will cause a CMake error.


Generated build.ninja after the fix:

...
build lib$ dir/libout2.so: CMAKE_SYMLINK_LIBRARY lib$ dir/libout2.so.1.0
  POST_BUILD = :
  SONAME = "lib dir/libout2.so.1.0"
...

Which will make the build successful.

Edited by Marcus Ong

Merge request reports