diff options
author | Stephen Kelly <stephen.kelly@kdab.com> | 2012-08-27 14:02:12 +0200 |
---|---|---|
committer | Qt by Nokia <qt-info@nokia.com> | 2012-08-27 23:23:23 +0200 |
commit | 6c27c74ace56597d436468f39765b19b87a058ec (patch) | |
tree | 67b4417dc1f41aa23c73160d7fe2f5d757b0dbe1 | |
parent | 6263e9078aa1884923014b4b09c6f8eaab13c654 (diff) |
Add some error checking to the qt5_use_modules function.
Change-Id: I8fa2f10edbee1080646324c0689b23eda44aa75d
Reviewed-by: Alexander Neundorf <neundorf@kde.org>
Reviewed-by: Stephen Kelly <stephen.kelly@kdab.com>
-rw-r--r-- | src/corelib/Qt5CoreMacros.cmake | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/corelib/Qt5CoreMacros.cmake b/src/corelib/Qt5CoreMacros.cmake index 608c9be6b9..a61aaf832a 100644 --- a/src/corelib/Qt5CoreMacros.cmake +++ b/src/corelib/Qt5CoreMacros.cmake @@ -214,12 +214,20 @@ endfunction() if (NOT CMAKE_VERSION VERSION_LESS 2.8.9) function(qt5_use_modules _target _link_type) + if (NOT TARGET ${_target}) + message(FATAL_ERROR "The first argument to qt5_use_modules must be an existing target.") + endif() 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() + + if ("${modules}" STREQUAL "") + message(FATAL_ERROR "qt5_use_modules requires at least one Qt module to use.") + endif() + foreach(_module ${modules}) if (NOT Qt5${_module}_FOUND) find_package(Qt5${_module} PATHS ${_qt5_corelib_install_prefix} NO_DEFAULT_PATH) |