Displaying a target's list of linked libraries in cmake

后端 未结 4 2109
谎友^
谎友^ 2021-02-02 13:38

Is there a way to print a list the filenames for the libraries linked into a target via the target_link_libraries command

or even better, have all a target\'s dependenci

4条回答
  •  醉酒成梦
    2021-02-02 13:55

    Actually not(*).

    However, you can use a cmake variable to collect the name of the libraries that you want to link (using the set( ... or the list(APPEND ... command), and then use this variable in your target_link_libraries command:

    target_link_libraries( ${YOUR_CMAKE_VARIABLE})
    

    The same variable can also be used to create your copy commands (for example using this custom target)


    (*) A similar question was asked here, and it got no definitive answer.

提交回复
热议问题