- foreach(qtmod CORE ${ARGV} ${MAIN})
- set(QUASSEL_QT_LIBRARIES ${QUASSEL_QT_LIBRARIES} ${QT_QT${qtmod}_LIBRARY})
- if(STATIC)
- set(QUASSEL_QT_LIBRARIES ${QUASSEL_QT_LIBRARIES} ${QT_${qtmod}_LIB_DEPENDENCIES})
- endif(STATIC)
- endforeach(qtmod ${ARGV})
- set(QUASSEL_QT_LIBRARIES ${QUASSEL_QT_LIBRARIES} ${QT_LIBRARIES})
-endmacro(setup_qt4_variables)
+ foreach(qtmod Core ${ARGV} ${MAIN})
+ if(WITH_QT5)
+ find_package(Qt5${qtmod} ${QT_MIN_VERSION} REQUIRED)
+ list(APPEND QUASSEL_QT_LIBRARIES ${Qt5${qtmod}_LIBRARIES})
+ list(APPEND QUASSEL_QT_INCLUDES ${Qt5${qtmod}_INCLUDE_DIRS})
+ list(APPEND QUASSEL_QT_DEFINITIONS ${Qt5${qtmod}_DEFINITIONS} ${Qt5${qtmod}_EXECUTABLE_COMPILE_FLAGS})
+ else(WITH_QT5)
+ string(TOUPPER ${qtmod} QTMOD)
+ list(APPEND QUASSEL_QT_LIBRARIES ${QT_QT${QTMOD}_LIBRARY})
+ if(STATIC)
+ list(APPEND QUASSEL_QT_LIBRARIES ${QT_QT${QTMOD}_LIB_DEPENDENCIES})
+ endif(STATIC)
+ list(APPEND QUASSEL_QT_INCLUDES ${QT_QT${QTMOD}_INCLUDE_DIR})
+ list(APPEND QUASSEL_QT_DEFINITIONS -DQT_QT${QTMOD}_LIB)
+ endif(WITH_QT5)
+ endforeach(qtmod)
+
+ list(REMOVE_DUPLICATES QUASSEL_QT_LIBRARIES)
+ list(REMOVE_DUPLICATES QUASSEL_QT_INCLUDES)
+ list(REMOVE_DUPLICATES QUASSEL_QT_DEFINITIONS)
+
+ # The COMPILE_FLAGS property expects a string, not a list...
+ set(QUASSEL_QT_COMPILEFLAGS )
+ foreach(flag ${QUASSEL_QT_DEFINITIONS})
+ set(QUASSEL_QT_COMPILEFLAGS "${QUASSEL_QT_COMPILEFLAGS} ${flag}")
+ endforeach(flag)
+
+endmacro(setup_qt_variables)