diff options
author | Stephen Kelly <steveire@gmail.com> | 2012-11-20 14:53:41 +0100 |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2013-01-23 14:15:41 -0500 |
commit | e3b5eb6b23e5d2b6034e1c13716abb73ab6b3397 (patch) | |
tree | 835263e83ceabd38952b943b25d83a6efb0cf78d /Modules | |
parent | 6c8d8afe344aa2e0ba0c5c881d397a28a559dcbd (diff) | |
download | cmake-e3b5eb6b23e5d2b6034e1c13716abb73ab6b3397.tar.gz |
Automatically link to the qtmain library when linking to QtCore.
When using QAxServer, ensure that the qtmain library is excluded
by reporting an error at CMake time if it is not.
Diffstat (limited to 'Modules')
-rw-r--r-- | Modules/FindQt4.cmake | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/Modules/FindQt4.cmake b/Modules/FindQt4.cmake index 7baa11b7c1..35420b48b7 100644 --- a/Modules/FindQt4.cmake +++ b/Modules/FindQt4.cmake @@ -65,6 +65,12 @@ # is much more flexible, but requires that FindQt4.cmake is executed before # such an exported dependency file is processed. # +# Note that if using IMPORTED targets, the qtmain.lib static library is +# automatically linked on Windows. To disable that globally, set the +# QT4_NO_LINK_QTMAIN variable before finding Qt4. To disable that for a +# particular executable, set the QT4_NO_LINK_QTMAIN target property to +# True on the executable. +# # QT_INCLUDE_DIRS_NO_SYSTEM # If this variable is set to TRUE, the Qt include directories # in the QT_USE_FILE will NOT have the SYSTEM keyword set. @@ -1009,7 +1015,14 @@ if (QT_QMAKE_EXECUTABLE AND QTVERSION) # platform dependent libraries if(Q_WS_WIN) _QT4_ADJUST_LIB_VARS(qtmain) + _QT4_ADJUST_LIB_VARS(QAxServer) + set_property(TARGET Qt4::QAxServer PROPERTY + INTERFACE_QT4_NO_LINK_QTMAIN ON + ) + set_property(TARGET Qt4::QAxServer APPEND PROPERTY + COMPATIBLE_INTERFACE_BOOL QT4_NO_LINK_QTMAIN) + _QT4_ADJUST_LIB_VARS(QAxContainer) endif() @@ -1049,6 +1062,21 @@ if (QT_QMAKE_EXECUTABLE AND QTVERSION) _qt4_add_target_private_depends(phonon DBus) endif() + if (WIN32 AND NOT QT4_NO_LINK_QTMAIN) + set(_isExe $<STREQUAL:$<TARGET_PROPERTY:TYPE>,EXECUTABLE>) + set(_isWin32 $<BOOL:$<TARGET_PROPERTY:WIN32_EXECUTABLE>>) + set(_isNotExcluded $<NOT:$<BOOL:$<TARGET_PROPERTY:QT4_NO_LINK_QTMAIN>>>) + set(_isPolicyNEW $<TARGET_POLICY:CMP0020>) + set_property(TARGET Qt4::QtCore APPEND PROPERTY + IMPORTED_LINK_INTERFACE_LIBRARIES + $<$<AND:${_isExe},${_isWin32},${_isNotExcluded},${_isPolicyNEW}>:Qt4::qtmain> + ) + unset(_isExe) + unset(_isWin32) + unset(_isNotExcluded) + unset(_isPolicyNEW) + endif() + ####################################### # # Check the executables of Qt |