summaryrefslogtreecommitdiffstats
path: root/Modules
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2013-01-23 20:11:24 (GMT)
committerCMake Topic Stage <kwrobot@kitware.com>2013-01-23 20:11:24 (GMT)
commita37b0e3ebfb7f607ff29c7c4946b2c003c7a7bf9 (patch)
tree38ce80e0317d72dca99fa713397e3e0c26dc5eeb /Modules
parentbf2e4e8cb1696a8da626483217ec73ab2b20811d (diff)
parente3b5eb6b23e5d2b6034e1c13716abb73ab6b3397 (diff)
downloadCMake-a37b0e3ebfb7f607ff29c7c4946b2c003c7a7bf9.zip
CMake-a37b0e3ebfb7f607ff29c7c4946b2c003c7a7bf9.tar.gz
CMake-a37b0e3ebfb7f607ff29c7c4946b2c003c7a7bf9.tar.bz2
Merge topic 'qt4-autolink-qtmain'
e3b5eb6 Automatically link to the qtmain library when linking to QtCore. 6c8d8af Add the $<TARGET_POLICY> expression
Diffstat (limited to 'Modules')
-rw-r--r--Modules/FindQt4.cmake28
1 files changed, 28 insertions, 0 deletions
diff --git a/Modules/FindQt4.cmake b/Modules/FindQt4.cmake
index 7baa11b..35420b4 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