[cmake-developers] Generating imported library targets without the cmake executable

Brad King brad.king at kitware.com
Tue Nov 29 11:07:37 EST 2011


On 11/29/2011 10:53 AM, Stephen Kelly wrote:
> Qt5Core_LIBRARY is intended to be the thing that users would use in the
> CMakeLists.txt.
>
> I've had another read of the Modules/readme.txt and I guess I need to change
> it to be consistent.
>
> So should I rename them or should I instead add
>
> set(Qt5Core_LIBRARIES ${Qt5Core_LIBRARY})

This convention is only used in Find modules to collect the individual
find results.  In the Config modules you already know the complete list
so you can go straight to the plural name.  So the minimum is:

   set(Qt5Core_LIBRARIES Qt5Core)
   set(Qt5Core_INCLUDE_DIRS "${_qt5_install_prefix}/include"
                            "${_qt5_install_prefix}/include/QtCore")

The library directory holding Qt5Core is not needed in

   set(Qt5Core_LIBRARY_DIRS "${_qt5_install_prefix}/lib") # not needed

because the imported target know where to find the libraries.  However,
if there are dependencies on third-party libraries that are not loaded
as imported targets or full paths then the locations of those belong
in the above list.

Is there a reason to provide

   set(Qt5Core_HEADER_DIR "${_qt5_install_prefix}/include" )

at all?

-Brad



More information about the cmake-developers mailing list