summaryrefslogtreecommitdiffstats
path: root/Modules/Qt4Macros.cmake
diff options
context:
space:
mode:
authorDavid Cole <david.cole@kitware.com>2012-08-20 19:42:43 (GMT)
committerCMake Topic Stage <kwrobot@kitware.com>2012-08-20 19:42:43 (GMT)
commit32710211ad09291d89415d7d042e44c3da8f5a6c (patch)
tree1ee0c579bd1bc9359dfa30cd235edb6abd0812b8 /Modules/Qt4Macros.cmake
parentc79dd4d951eec397692dd4af18e6a85b25a4f4ef (diff)
parent1420691b3548ab34c85fb10b4798586e974e4c98 (diff)
downloadCMake-32710211ad09291d89415d7d042e44c3da8f5a6c.zip
CMake-32710211ad09291d89415d7d042e44c3da8f5a6c.tar.gz
CMake-32710211ad09291d89415d7d042e44c3da8f5a6c.tar.bz2
Merge topic 'qt4_use_modules'
1420691 Add new qt4_use_modules function.
Diffstat (limited to 'Modules/Qt4Macros.cmake')
-rw-r--r--Modules/Qt4Macros.cmake21
1 files changed, 21 insertions, 0 deletions
diff --git a/Modules/Qt4Macros.cmake b/Modules/Qt4Macros.cmake
index 95a2176..7c9dc9e 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()