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>
bb10
Stephen Kelly 2012-08-27 14:02:12 +02:00 committed by Qt by Nokia
parent 6263e9078a
commit 6c27c74ace
1 changed files with 8 additions and 0 deletions

View File

@ -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)