[CMake] Dependency on imported target with ninja-generator
Patrick Boettcher
patrick.boettcher at posteo.de
Wed Jun 22 11:59:33 EDT 2016
Hi list,
I'm finding myself in the following situation.
- Project A generates libmain.a and export(TARGETS ... NAMESPACE ns) it
to a file. The target is called ns::main
- Project B includes this file and has some executables link with
libmain.a (via target_link_libraries(exe ns::main).
- Project B's CMakeLists.txt contains a add_custom_target(build ...)
which runs cmake --build in project A's build-dir.
- the target build is a add_dependency() of ns::main.
Building it with gnu-make works like a charm - make is entering project
A's build-dir before linking.
Building it with ninja fails with not finding libmain.a - which is
normal it has not yet been built. Ninja seems to evaluate the complete
dependency-tree of files before doing anything.
Is there a way to fix this?
Thanks.
best regards,
--
Patrick.
More information about the CMake
mailing list