diff options
-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) |