2015-11-06 21:03:18 +03:00
|
|
|
# - macro similar to target_link_libraries, which links Qt components
|
2018-03-14 18:15:51 +03:00
|
|
|
# names of the components are passed in Qt4/Qt5 agnostic way (Core, DBus, Xml...)
|
2015-11-06 21:03:18 +03:00
|
|
|
# and the macro links Qt4 ones if QT4_FOUND is set or Qt5 ones if not
|
|
|
|
|
|
|
|
macro (target_link_qt_components target)
|
|
|
|
if (QT4_FOUND)
|
|
|
|
foreach(_cmp ${ARGN})
|
2017-01-21 18:36:52 +03:00
|
|
|
if ("${_cmp}" STREQUAL "PRIVATE" OR
|
|
|
|
"${_cmp}" STREQUAL "PUBLIC" OR
|
|
|
|
"${_cmp}" STREQUAL "INTERFACE")
|
|
|
|
list(APPEND _QT_CMPNTS "${_cmp}")
|
|
|
|
else()
|
|
|
|
list(APPEND _QT_CMPNTS "Qt4::Qt${_cmp}")
|
|
|
|
endif()
|
2015-11-06 21:03:18 +03:00
|
|
|
endforeach()
|
|
|
|
else (QT4_FOUND)
|
|
|
|
foreach(_cmp ${ARGN})
|
2017-01-21 18:36:52 +03:00
|
|
|
if ("${_cmp}" STREQUAL "PRIVATE" OR
|
|
|
|
"${_cmp}" STREQUAL "PUBLIC" OR
|
|
|
|
"${_cmp}" STREQUAL "INTERFACE")
|
|
|
|
list(APPEND _QT_CMPNTS "${_cmp}")
|
|
|
|
else()
|
|
|
|
list(APPEND _QT_CMPNTS "Qt5::${_cmp}")
|
|
|
|
endif()
|
2015-11-06 21:03:18 +03:00
|
|
|
endforeach()
|
|
|
|
endif (QT4_FOUND)
|
|
|
|
target_link_libraries(${target} ${_QT_CMPNTS})
|
|
|
|
endmacro()
|