# HG changeset patch # User Sebastien Jodogne # Date 1573579726 -3600 # Node ID 4f99c7905f8d7dfcc209f4b2682ed23eeee69d37 # Parent 7d23c43ba5550593045311584979aaf10c739bdd mingw qt diff -r 7d23c43ba555 -r 4f99c7905f8d Resources/CMake/QtConfiguration.cmake --- a/Resources/CMake/QtConfiguration.cmake Fri Nov 08 18:14:59 2019 +0100 +++ b/Resources/CMake/QtConfiguration.cmake Tue Nov 12 18:28:46 2019 +0100 @@ -20,26 +20,12 @@ set(CMAKE_AUTOMOC OFF) set(CMAKE_AUTOUIC OFF) -if ("${CMAKE_SYSTEM_VERSION}" STREQUAL "LinuxStandardBase") - # Linux Standard Base version 5 ships Qt 4.2.3 + +## Note that these set of macros MUST be defined as a "function()", +## otherwise it fails +function(DEFINE_QT_MACROS) include(Qt4Macros) - # The script "LinuxStandardBaseUic.py" is just a wrapper around the - # "uic" compiler from LSB that does not support the "" - # header that is automatically added by Qt Creator - set(QT_UIC_EXECUTABLE ${CMAKE_CURRENT_LIST_DIR}/LinuxStandardBaseUic.py) - - set(QT_MOC_EXECUTABLE ${LSB_PATH}/bin/moc) - - include_directories( - ${LSB_PATH}/include/QtCore - ${LSB_PATH}/include/QtGui - ${LSB_PATH}/include/QtOpenGL - ) - - link_libraries(QtCore QtGui QtOpenGL) - - ## ## This part is adapted from file "Qt4Macros.cmake" shipped with ## CMake 3.5.1, released under the following license: @@ -86,9 +72,59 @@ ## ## End of "Qt4Macros.cmake" adaptation. ## +endfunction() + + +if ("${CMAKE_SYSTEM_VERSION}" STREQUAL "LinuxStandardBase") + # Linux Standard Base version 5 ships Qt 4.2.3 + DEFINE_QT_MACROS() + + # The script "LinuxStandardBaseUic.py" is just a wrapper around the + # "uic" compiler from LSB that does not support the "" + # header that is automatically added by Qt Creator + set(QT_UIC_EXECUTABLE ${CMAKE_CURRENT_LIST_DIR}/LinuxStandardBaseUic.py) + + set(QT_MOC_EXECUTABLE ${LSB_PATH}/bin/moc) + + include_directories( + ${LSB_PATH}/include/QtCore + ${LSB_PATH}/include/QtGui + ${LSB_PATH}/include/QtOpenGL + ) + + link_libraries(QtCore QtGui QtOpenGL) + +elseif (${CMAKE_SYSTEM_NAME} STREQUAL "Windows") + DEFINE_QT_MACROS() + + include_directories(${QT5_INSTALL_ROOT}/include) + link_directories(${QT5_INSTALL_ROOT}/lib) + + set(QT_UIC_EXECUTABLE ${QT5_INSTALL_ROOT}/bin/uic) + set(QT_MOC_EXECUTABLE ${QT5_INSTALL_ROOT}/bin/moc) + + include_directories( + ${QT5_INSTALL_ROOT}/include/QtCore + ${QT5_INSTALL_ROOT}/include/QtGui + ${QT5_INSTALL_ROOT}/include/QtOpenGL + ${QT5_INSTALL_ROOT}/include/QtWidgets + ) + + link_libraries(Qt5Core Qt5Gui Qt5OpenGL Qt5Widgets) + + file(COPY + ${QT5_INSTALL_ROOT}/bin/Qt5Core.dll + ${QT5_INSTALL_ROOT}/bin/Qt5Gui.dll + ${QT5_INSTALL_ROOT}/bin/Qt5OpenGL.dll + ${QT5_INSTALL_ROOT}/bin/Qt5Widgets.dll + DESTINATION ${CMAKE_CURRENT_BINARY_DIR}) + + file(COPY + ${QT5_INSTALL_ROOT}/plugins/platforms/qwindows.dll + DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/platforms) else() - # Not using Linux Standard Base + # Not using Windows, not using Linux Standard Base, # Find the QtWidgets library find_package(Qt5Widgets QUIET)