[Cmake-commits] CMake branch, next, updated. v2.8.9-151-g31007c0

Stephen Kelly steveire at gmail.com
Sun Aug 19 17:46:26 EDT 2012


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "CMake".

The branch, next has been updated
       via  31007c03c763a61f693543e33277871cea55925f (commit)
       via  1420691b3548ab34c85fb10b4798586e974e4c98 (commit)
      from  7c2014f5bac6af5164bd02acd3740d683cc40c12 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=31007c03c763a61f693543e33277871cea55925f
commit 31007c03c763a61f693543e33277871cea55925f
Merge: 7c2014f 1420691
Author:     Stephen Kelly <steveire at gmail.com>
AuthorDate: Sun Aug 19 17:46:21 2012 -0400
Commit:     CMake Topic Stage <kwrobot at kitware.com>
CommitDate: Sun Aug 19 17:46:21 2012 -0400

    Merge topic 'qt4_use_modules' into next
    
    1420691 Add new qt4_use_modules function.


http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=1420691b3548ab34c85fb10b4798586e974e4c98
commit 1420691b3548ab34c85fb10b4798586e974e4c98
Author:     Stephen Kelly <steveire at gmail.com>
AuthorDate: Wed Aug 8 23:31:52 2012 +0200
Commit:     Stephen Kelly <steveire at gmail.com>
CommitDate: Sun Aug 19 23:45:09 2012 +0200

    Add new qt4_use_modules function.

diff --git a/Modules/FindQt4.cmake b/Modules/FindQt4.cmake
index e7d25c9..c5d98fa 100644
--- a/Modules/FindQt4.cmake
+++ b/Modules/FindQt4.cmake
@@ -163,6 +163,17 @@
 #        filenames can be found in qm_files. The ts_files
 #        must exists and are not updated in any way.
 #
+# function QT4_USE_MODULES( target [link_type] modules...)
+#        Make <target> use the <modules> from Qt. Using a Qt module means
+#        to link to the library, add the relevant include directories for the module,
+#        and add the relevant compiler defines for using the module.
+#        Modules are roughly equivalent to components of Qt4, so usage would be
+#        something like:
+#         qt4_use_modules(myexe Core Gui Declarative)
+#        to use QtCore, QtGui and QtDeclarative. The optional <link_type> argument can
+#        be specified as either LINK_PUBLIC or LINK_PRIVATE to specify the same argument
+#        to the target_link_libraries call.
+#
 #
 #  Below is a detailed list of variables that FindQt4.cmake sets.
 #  QT_FOUND         If false, don't try to use Qt.
diff --git a/Modules/Qt4Macros.cmake b/Modules/Qt4Macros.cmake
index 4324347..76e4604 100644
--- a/Modules/Qt4Macros.cmake
+++ b/Modules/Qt4Macros.cmake
@@ -439,3 +439,24 @@ macro(QT4_ADD_TRANSLATION _qm_files)
     set(${_qm_files} ${${_qm_files}} ${qm})
   endforeach ()
 endmacro()
+
+function(qt4_use_modules _target _link_type)
+  if ("${_link_type}" STREQUAL "LINK_PUBLIC" OR "${_link_type}" STREQUAL "LINK_PRIVATE")
+    set(modules ${ARGN})
+    set(link_type ${_link_type})
+  else()
+    set(modules ${_link_type} ${ARGN})
+  endif()
+  foreach(_module ${modules})
+    string(TOUPPER ${_module} _ucmodule)
+    if (NOT QT_QT${_ucmodule}_FOUND)
+      message(FATAL_ERROR "Can not use \"${_module}\" module which has not yet been found.")
+    endif()
+    if ("${_ucmodule}" STREQUAL "MAIN")
+      message(FATAL_ERROR "Can not use \"${_module}\" module with qt4_use_modules.")
+    endif()
+    target_link_libraries(${_target} ${link_type} ${QT_QT${_ucmodule}_LIBRARY})
+    set_property(TARGET ${_target} APPEND PROPERTY INCLUDE_DIRECTORIES ${QT_QT${_ucmodule}_INCLUDE_DIR} ${QT_HEADERS_DIR} ${QT_MKSPECS_DIR}/default)
+    set_property(TARGET ${_target} APPEND PROPERTY COMPILE_DEFINITIONS ${QT_QT${_ucmodule}_COMPILE_DEFINITIONS})
+  endforeach()
+endfunction()

-----------------------------------------------------------------------

Summary of changes:
 Modules/FindQt4.cmake   |   11 +++++++++++
 Modules/Qt4Macros.cmake |   21 +++++++++++++++++++++
 2 files changed, 32 insertions(+), 0 deletions(-)


hooks/post-receive
-- 
CMake


More information about the Cmake-commits mailing list