How can I get the list of dependencies of cmake ta

2019-01-23 13:30发布

问题:

For instance, how can I know if my executable target E depends on my library target L?

Let's image E depends on L1 and L2, but I don't know if they depend on L.

target_link_libraries(E L1 L2)

I'd like to get the list from cmake itself before calling target_link_libraries, so that I can do some tricks if I detect that E depends on two libraries which are incompatible. I played a bit with GetPrerequisites, but this finds out dependencies on existing libraries which are on disk, not on target which are being built.

thanks

回答1:

You can use CMake's "dependency graphs generator". Please read this link for details

cmake --graphviz=test.dot . ...


标签: cmake