[CMake] Should I create IMPORTED targets for executables?
Stephen Kelly
steveire at gmail.com
Mon Jul 23 05:14:19 EDT 2012
Stephen Kelly wrote:
>
> Hi,
>
> For Qt 5 I'm creating IMPORTED targets for all the libraries, which has
> several benefits.
>
> I'm not sure if there are any benefits to creating IMPORTED targets for
> the executables too? Currently I just create variables with the full paths
> to the executables (moc, uic, rcc) instead.
>
> Is there any reason to change those to IMPORTED executables?
Hi,
Just for informations sake, I've submitted a patch to create imported
targets in the Qt 5 CMake files.
https://codereview.qt-project.org/#change,31245
The justification is that it is future-proof in terms of future CMake
features, and also in case we ever need to add properties with a target
scope to executables. The alternative to that would otherwise be something
like set(QT_UIC_EXECUTABLE_FOO "Bar"), which wouldn't have the same scope as
the TARGET. I also don't want to end up with the situation we have with
FindQt4.cmake where we need to define QT_USE_IMPORTED_TARGETS before finding
the package because of backwards compatibility.
Thanks,
Steve.
More information about the CMake
mailing list