Framework installation problems with ninja

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view

Framework installation problems with ninja

Shoaib Meenai

Let's say I have a simple CMakeLists.txt:


cmake_minimum_required(VERSION 3.11)

project(foo C)



foo/CMakeLists.txt looks like:


add_library(foo SHARED foo.c)



                      FRAMEWORK ON

                      FRAMEWORK_VERSION A)

install(TARGETS foo



                  DEPENDS foo

                  COMMAND echo "Installing")


An actual useful install-foo target would do something along the lines of `cmake -P cmake_install.cmake`, but we don't need that to demonstrate the issue. foo.c is also irrelevant; it could even be empty.


With CMake 3.11.4 and when using the Ninja generator, my custom install-foo target ends up transitively depending on "foo/foo.framework/foo", which doesn't exist and causes a build error. There is a "foo.framework/foo" target, which is just a phony target depending on "foo/foo.framework/Versions/A/foo" (which is the actual library), and I suspect that's the actual desired dependency, but instead, the subdirectory is being incorrectly prepended to the dependency name.


This works correctly when using the Makefile generator instead of the Ninja generator. It works with the Ninja generator if my framework target is in the top-level CMakeLists.txt instead of a subdirectory, but that's not a viable workaround for my use case.


Am I doing something wrong, or is this a bug with CMake's Ninja generator? If it's the latter, any thoughts on how to work around it? I suppose I could try to manually create the "foo/foo.framework/foo" target, but that seems kinda gross.



Shoaib Meenai


Powered by

Please keep messages on-topic and check the CMake FAQ at:

Kitware offers various services to support the CMake community. For more information on each offering, please visit:

CMake Support:
CMake Consulting:
CMake Training Courses:

Visit other Kitware open-source projects at

Follow this link to subscribe/unsubscribe: