[CMake] Ninja target aliases generation - mixing absolute target path with relative

Vladimir Yelnikov vladimir.yelnikov at gmail.com
Fri Sep 11 13:14:29 EDT 2015


Dear all,

Project has following structure (and I can't change it)

-project
  -module1
     -CMakeLists.txt (module1 build rules, depends on module2 using
add_subdirectory("../module2" "${binarypath}")
     -lib1
       -CMakeLists.txt (depends on lib3)
     -lib2
       -CMakeLists.txt
  -module2
     -lib3
       -CMakeLists.txt
     -lib4
       -CMakeLists.txt

But ninja generator generates build rule with absolute paths:
build d$:\project\module2\lib3:....

But depends it as ..\module2\lib3

as a result I got following error:
ninja: error: '../module2/lib3.lib', needed by 'lib1', missing and no known
rule to make it

I added additional phony to build.ninja and it worked:
build ../module2/lib3.lib: phony d$:\project\module2\lib3

How should I fix CMake files to generate same names/aliases for targets?

-- 
Best Wishes,
Vladimir Yelnikov
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/cmake/attachments/20150911/2abe623e/attachment.html>


More information about the CMake mailing list