Framework installation with Ninja is incorrect
Here is a minimal example to show the problem:
CMakeLists.txt
cmake_minimum_required(VERSION 3.11)
project(foo C)
add_subdirectory(foo)
foo/CMakeLists.txt
add_library(foo SHARED foo.c)
set_target_properties(foo
PROPERTIES
FRAMEWORK ON
FRAMEWORK_VERSION A)
install(TARGETS foo
FRAMEWORK DESTINATION Frameworks)
add_custom_target(install-foo
DEPENDS foo
COMMAND echo "Installing")
Running cmake <path_to_project> -G Ninja
followed by ninja install-foo
, things break. What ends up happening is install-foo
ends up (transitively) depending on foo/foo.framework/foo
, which is a non-existent target. There does exist a target called foo.framework/foo
, which is a phony target that depeneds on foo/foo.framework/Versions/A/foo
, which is the actual library that gets generated. I suspect that it actually should depend on foo.framework/foo
but the subdirectory is incorrectly being concatenated with the desired target. Note that foo/foo.framework/foo
does exist as a file. Specifically it's a symlink to Version/Current/foo
but the ninja build file doesn't know about it.
Note that this setup actually does work with Make. It also works if your framework target is created in the top level CMakeLists.txt (with Ninja and Make).
I'm assuming that this behavior is incorrect because it works with Make. Is it possible I'm doing something incorrect here?
Thanks!