Getting imported targets through `find_package`?

后端 未结 2 2148
[愿得一人]
[愿得一人] 2020-12-13 21:52

The CMake manual of Qt 5 uses find_package and says:

Imported targets are created for each Qt module. Imported target names should be pre

2条回答
  •  Happy的楠姐
    2020-12-13 22:22

    Actually there is no "magic" with results of find_package: this command just searches appropriate FindXXX.cmake script and executes it.

    If Find script sets XXX_LIBRARY variable, then caller can use this variable.

    If Find script creates imported targets, then caller can use these targets.

    If Find script neither sets XXX_LIBRARY variable nor creates imported targets ... well, then usage of the script is somehow different.

    Documentation for find_package describes usual usage of Find scripts. But in any case you need to consult documentation about concrete script (this documentation is normally contained in the script itself).

提交回复
热议问题