diff --git a/src/corelib/Qt5CoreMacros.cmake b/src/corelib/Qt5CoreMacros.cmake index 089445a184..614b79ab88 100644 --- a/src/corelib/Qt5CoreMacros.cmake +++ b/src/corelib/Qt5CoreMacros.cmake @@ -217,29 +217,29 @@ endfunction() if (NOT CMAKE_VERSION VERSION_LESS 2.8.9) - function(qt5_use_modules _target _link_type) + macro(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}) + set(_qt5_modules ${ARGN}) + set(_qt5_link_type ${_link_type}) else() - set(modules ${_link_type} ${ARGN}) + set(_qt5_modules ${_link_type} ${ARGN}) endif() - if ("${modules}" STREQUAL "") + if ("${_qt5_modules}" STREQUAL "") message(FATAL_ERROR "qt5_use_modules requires at least one Qt module to use.") endif() - foreach(_module ${modules}) + foreach(_module ${_qt5_modules}) if (NOT Qt5${_module}_FOUND) find_package(Qt5${_module} PATHS ${_qt5_corelib_install_prefix} NO_DEFAULT_PATH) if (NOT Qt5${_module}_FOUND) message(FATAL_ERROR "Can not use \"${_module}\" module which has not yet been found.") endif() endif() - target_link_libraries(${_target} ${link_type} ${Qt5${_module}_LIBRARIES}) + target_link_libraries(${_target} ${_qt5_link_type} ${Qt5${_module}_LIBRARIES}) set_property(TARGET ${_target} APPEND PROPERTY INCLUDE_DIRECTORIES ${Qt5${_module}_INCLUDE_DIRS}) set_property(TARGET ${_target} APPEND PROPERTY COMPILE_DEFINITIONS ${Qt5${_module}_COMPILE_DEFINITIONS}) set_property(TARGET ${_target} APPEND PROPERTY COMPILE_DEFINITIONS_RELEASE QT_NO_DEBUG) @@ -248,5 +248,5 @@ if (NOT CMAKE_VERSION VERSION_LESS 2.8.9) set_property(TARGET ${_target} PROPERTY POSITION_INDEPENDENT_CODE ${Qt5_POSITION_INDEPENDENT_CODE}) endif() endforeach() - endfunction() + endmacro() endif()