Skip to content

Commit

Permalink
CMakeLists.txt changes for Qt6 compatibility
Browse files Browse the repository at this point in the history
- Should work with Qt5.15 and later.
- Recommended: Qt5.15.2 and Qt6.2.4
  • Loading branch information
gzotti committed Jul 30, 2022
1 parent 96addc9 commit e90614e
Show file tree
Hide file tree
Showing 35 changed files with 184 additions and 161 deletions.
87 changes: 51 additions & 36 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,9 @@ ADD_DEFINITIONS(-DPACKAGE_VERSION="${PACKAGE_VERSION}")
ADD_DEFINITIONS(-DCOPYRIGHT_YEARS="${COPYRIGHT_YEARS}")
ADD_DEFINITIONS(-DSTELLARIUM_SOURCE_DIR="${PROJECT_SOURCE_DIR}")

# currently Qt 5.12 is recommended
SET(MINIMAL_QT_VERSION "5.9.0")
# Qt 5.15 is required as it provides version-less CMake functions (QT_WRAP_UI etc.)
SET(MINIMAL_QT_VERSION "5.15.0")
#SET(MINIMAL_QT_VERSION "6.2.0")
# TODO: Check real minimal supported version of GPSD API
SET(MINIMAL_GPS_API_VERSION "6.0")

Expand Down Expand Up @@ -242,7 +243,7 @@ SET(CMAKE_CXX_EXTENSIONS OFF)
# NOTE: C_STANDARD 17 and 23 values added in CMake 3.21
# https://gitlab.kitware.com/cmake/cmake/-/issues/22366
# Ubuntu 18.04 have GCC 7.5 - so, C11 only
SET(CMAKE_C_STANDARD 11)
SET(CMAKE_C_STANDARD 17)
SET(CMAKE_C_STANDARD_REQUIRED ON)
SET(CMAKE_C_EXTENSIONS OFF)

Expand Down Expand Up @@ -321,6 +322,9 @@ ENDIF()
#SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fvisibility=hidden -ffunction-sections -flto")
#SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,--gc-sections -flto -ffunction-sections -fuse-linker-plugin")

########### Detect Qt version
find_package(QT NAMES Qt6 Qt5 COMPONENTS Core REQUIRED)

########### Others ###########
# Activate translation
SET(ENABLE_NLS 1 CACHE BOOL "Define whether program translation should be supported.")
Expand Down Expand Up @@ -385,14 +389,18 @@ IF(ENABLE_SPOUT)
MARK_AS_ADVANCED(SPOUT_LIBRARY_DLL)
ENDIF(ENABLE_SPOUT)

SET(ENABLE_SCRIPTING 1 CACHE BOOL "Define whether scripting features should be activated.")
IF(ENABLE_SCRIPTING)
ADD_DEFINITIONS(-DENABLE_SCRIPTING)
# (De-)Activate the script edit console
SET(ENABLE_SCRIPT_CONSOLE 1 CACHE BOOL "Define whether to build the script console feature.")
IF(ENABLE_SCRIPT_CONSOLE)
ADD_DEFINITIONS(-DENABLE_SCRIPT_CONSOLE)
IF(${QT_VERSION_MAJOR} EQUAL 5)
SET(ENABLE_SCRIPTING 1 CACHE BOOL "Define whether scripting features should be activated.")
IF(ENABLE_SCRIPTING)
ADD_DEFINITIONS(-DENABLE_SCRIPTING)
# (De-)Activate the script edit console
SET(ENABLE_SCRIPT_CONSOLE 1 CACHE BOOL "Define whether to build the script console feature.")
IF(ENABLE_SCRIPT_CONSOLE)
ADD_DEFINITIONS(-DENABLE_SCRIPT_CONSOLE)
ENDIF()
ENDIF()
ELSE()
SET(ENABLE_SCRIPTING 0 CACHE BOOL "Define whether scripting features should be activated. Currently strictly no Scripting on Qt6!")
ENDIF()

SET(STELLARIUM_GUI_MODE Standard CACHE STRING "Choose the type of GUI to build, options are: Standard, None")
Expand All @@ -408,15 +416,6 @@ ELSE()
SET(GENERATE_STELMAINLIB 0)
ENDIF()

IF(ENABLE_TESTING)
ENABLE_TESTING()
ADD_DEFINITIONS(-DENABLE_TESTING)
FIND_PACKAGE(Qt5Test REQUIRED)
MESSAGE(STATUS "Unit tests support: enabled")
ELSE(ENABLE_TESTING)
MESSAGE(STATUS "Unit tests support: disabled")
ENDIF(ENABLE_TESTING)

########### User Guide ###############
IF(EXISTS "${CMAKE_SOURCE_DIR}/guide/guide.pdf")
MESSAGE(STATUS "Found Stellarium User Guide")
Expand Down Expand Up @@ -481,28 +480,35 @@ ADD_CUSTOM_TARGET(AllStaticPlugins ALL)
SET_TARGET_PROPERTIES(AllStaticPlugins PROPERTIES FOLDER "plugins")

########### Find packages ###########
FIND_PACKAGE(Qt5Core REQUIRED)
GET_TARGET_PROPERTY(QMAKE_LOCATION Qt5::qmake LOCATION)
find_package(QT NAMES Qt6 Qt5 COMPONENTS Core REQUIRED)

FIND_PACKAGE(Qt${QT_VERSION_MAJOR} COMPONENTS Core REQUIRED)
# GZ: Why bother about qmake at all?
#GET_TARGET_PROPERTY(QMAKE_LOCATION Qt5::qmake LOCATION)
IF(${QT_VERSION_MAJOR} EQUAL 5)
IF(${Qt5Core_VERSION} VERSION_LESS MINIMAL_QT_VERSION)
MESSAGE(FATAL_ERROR "Found Qt5: ${QMAKE_LOCATION} (found unsuitable version ${Qt5Core_VERSION}, required is ${MINIMAL_QT_VERSION})")
MESSAGE(FATAL_ERROR "Found Qt${QT_VERSION_MAJOR}: ${QMAKE_LOCATION} (found unsuitable version ${Qt5Core_VERSION}, required is ${MINIMAL_QT_VERSION})")
ELSE()
MESSAGE(STATUS "Found Qt5: ${QMAKE_LOCATION} (found suitable version ${Qt5Core_VERSION})")
MESSAGE(STATUS "Found Qt${QT_VERSION_MAJOR}: ${QMAKE_LOCATION} (found suitable version ${Qt5Core_VERSION})")
ENDIF()
ENDIF()
FIND_PACKAGE(Qt5Concurrent REQUIRED)
FIND_PACKAGE(Qt5Gui REQUIRED)
FIND_PACKAGE(Qt5Network REQUIRED)
FIND_PACKAGE(Qt5Widgets REQUIRED)
FIND_PACKAGE(Qt5Charts REQUIRED)
FIND_PACKAGE(Qt${QT_VERSION_MAJOR} COMPONENTS Concurrent REQUIRED)
FIND_PACKAGE(Qt${QT_VERSION_MAJOR} COMPONENTS Gui REQUIRED)
FIND_PACKAGE(Qt${QT_VERSION_MAJOR} COMPONENTS Network REQUIRED)
FIND_PACKAGE(Qt${QT_VERSION_MAJOR} COMPONENTS Widgets REQUIRED)
FIND_PACKAGE(Qt${QT_VERSION_MAJOR} COMPONENTS Charts REQUIRED)
IF(USE_PLUGIN_TELESCOPECONTROL OR ENABLE_GPS)
FIND_PACKAGE(Qt5SerialPort REQUIRED)
FIND_PACKAGE(Qt${QT_VERSION_MAJOR} COMPONENTS SerialPort REQUIRED)
ENDIF()
IF(WIN32)
FIND_PACKAGE(Qt5Svg REQUIRED)
FIND_PACKAGE(Qt5XmlPatterns REQUIRED)
FIND_PACKAGE(Qt${QT_VERSION_MAJOR} COMPONENTS Svg REQUIRED)
IF(${QT_VERSION_MAJOR} EQUAL 5)
FIND_PACKAGE(Qt${QT_VERSION_MAJOR} COMPONENTS XmlPatterns REQUIRED)
ENDIF()

# Qt 5.9 (LTS) use OpenSSL 1.0* and Qt 5.12 (LTS) and newest version of Qt use OpenSSL 1.1*
# Source: https://lists.qt-project.org/pipermail/releasing/2019-March/002614.html
IF(${Qt5Core_VERSION} VERSION_LESS "5.10")
IF((${QT_VERSION_MAJOR} EQUAL "5") AND (Qt5Core_VERSION VERSION_LESS "5.10"))
# OK, it's Qt 5.9, let's try found OpenSSL 1.0.x DLL's on Windows
FIND_FILE(OPENSSL_SSLEAY32_LIBRARY_DLL ssleay32.dll)
FIND_FILE(OPENSSL_LIBEAY32_LIBRARY_DLL libeay32.dll)
Expand Down Expand Up @@ -579,13 +585,13 @@ ENDIF()
IF(ENABLE_MEDIA)
SET(USE_QTOPENGL 1)
ADD_DEFINITIONS(-DENABLE_MEDIA)
FIND_PACKAGE(Qt5Multimedia REQUIRED)
FIND_PACKAGE(Qt5MultimediaWidgets REQUIRED)
FIND_PACKAGE(Qt${QT_VERSION_MAJOR} COMPONENTS Multimedia REQUIRED)
FIND_PACKAGE(Qt${QT_VERSION_MAJOR} COMPONENTS MultimediaWidgets REQUIRED)
ENDIF()

IF(ENABLE_GPS)
MESSAGE(STATUS "GPS: support by Qt's NMEA handling enabled.")
FIND_PACKAGE(Qt5Positioning REQUIRED)
FIND_PACKAGE(Qt${QT_VERSION_MAJOR} COMPONENTS Positioning REQUIRED)
ADD_DEFINITIONS(-DENABLE_GPS)
IF(WIN32)
SET(ENABLE_LIBGPS 0)
Expand Down Expand Up @@ -614,9 +620,18 @@ ENDIF(ENABLE_GPS)
IF(USE_QTOPENGL)
# QtOpenGL module is deprecated. After merging the QOpenGLWidget branch, we don't use this module directly anymore,
# but the QtMultimediaWidgets module requires it internally, so we still have to package it.
FIND_PACKAGE(Qt5OpenGL REQUIRED)
FIND_PACKAGE(Qt${QT_VERSION_MAJOR} COMPONENTS OpenGL REQUIRED)
ENDIF()

IF(ENABLE_TESTING)
ENABLE_TESTING()
ADD_DEFINITIONS(-DENABLE_TESTING)
FIND_PACKAGE(Qt${QT_VERSION_MAJOR} COMPONENTS Test REQUIRED)
MESSAGE(STATUS "Unit tests support: enabled")
ELSE(ENABLE_TESTING)
MESSAGE(STATUS "Unit tests support: disabled")
ENDIF(ENABLE_TESTING)

### Zlib package
FIND_PACKAGE(ZLIB QUIET) #quiet warnings about not found, we have our own version anyway

Expand Down
6 changes: 3 additions & 3 deletions plugins/AngleMeasure/src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,14 @@ SET(AngleMeasure_UIS
gui/angleMeasureDialog.ui
)

QT5_WRAP_UI(AngleMeasure_UIS_H ${AngleMeasure_UIS})
QT_WRAP_UI(AngleMeasure_UIS_H ${AngleMeasure_UIS})

################# compiles resources files ############
SET(AngleMeasure_RES ../AngleMeasure.qrc)
QT5_ADD_RESOURCES(AngleMeasure_RES_CXX ${AngleMeasure_RES})
QT_ADD_RESOURCES(AngleMeasure_RES_CXX ${AngleMeasure_RES})

ADD_LIBRARY(AngleMeasure-static STATIC ${AngleMeasure_SRCS} ${AngleMeasure_RES_CXX} ${AngleMeasure_UIS_H})
TARGET_LINK_LIBRARIES(AngleMeasure-static Qt5::Core Qt5::Widgets)
TARGET_LINK_LIBRARIES(AngleMeasure-static Qt${QT_VERSION_MAJOR}::Core Qt${QT_VERSION_MAJOR}::Widgets)
# The library target "AngleMeasure-static" has a default OUTPUT_NAME of "AngleMeasure-static", so change it.
SET_TARGET_PROPERTIES(AngleMeasure-static PROPERTIES OUTPUT_NAME "AngleMeasure")
SET_TARGET_PROPERTIES(AngleMeasure-static PROPERTIES COMPILE_FLAGS "-DQT_STATICPLUGIN")
Expand Down
6 changes: 3 additions & 3 deletions plugins/ArchaeoLines/src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,14 @@ SET(ArchaeoLines_UIS
gui/archaeoLinesDialogLocations.ui
)

QT5_WRAP_UI(ArchaeoLines_UIS_H ${ArchaeoLines_UIS})
QT_WRAP_UI(ArchaeoLines_UIS_H ${ArchaeoLines_UIS})

################# compiles resources files ############
SET(ArchaeoLines_RES ../ArchaeoLines.qrc)
QT5_ADD_RESOURCES(ArchaeoLines_RES_CXX ${ArchaeoLines_RES})
QT_ADD_RESOURCES(ArchaeoLines_RES_CXX ${ArchaeoLines_RES})

ADD_LIBRARY(ArchaeoLines-static STATIC ${ArchaeoLines_SRCS} ${ArchaeoLines_RES_CXX} ${ArchaeoLines_UIS_H})
TARGET_LINK_LIBRARIES(ArchaeoLines-static Qt5::Core Qt5::Widgets)
TARGET_LINK_LIBRARIES(ArchaeoLines-static Qt${QT_VERSION_MAJOR}::Core Qt${QT_VERSION_MAJOR}::Widgets)
# The library target "ArchaeoLines-static" has a default OUTPUT_NAME of "ArchaeoLines-static", so change it.
SET_TARGET_PROPERTIES(ArchaeoLines-static PROPERTIES OUTPUT_NAME "ArchaeoLines")
SET_TARGET_PROPERTIES(ArchaeoLines-static PROPERTIES COMPILE_FLAGS "-DQT_STATICPLUGIN")
Expand Down
6 changes: 3 additions & 3 deletions plugins/Calendars/src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -79,18 +79,18 @@ SET(Calendars_UIS
gui/calendarsDialog.ui
)

QT5_WRAP_UI(Calendars_UIS_H ${Calendars_UIS})
QT_WRAP_UI(Calendars_UIS_H ${Calendars_UIS})

################# compiles resources files ############
SET(Calendars_RES ../resources/Calendars.qrc)
QT5_ADD_RESOURCES(Calendars_RES_CXX ${Calendars_RES})
QT_ADD_RESOURCES(Calendars_RES_CXX ${Calendars_RES})

IF(ENABLE_TESTING)
ADD_SUBDIRECTORY(test)
ENDIF(ENABLE_TESTING)

ADD_LIBRARY(Calendars-static STATIC ${Calendars_SRCS} ${Calendars_RES_CXX} ${Calendars_UIS_H})
TARGET_LINK_LIBRARIES(Calendars-static Qt5::Core Qt5::Widgets)
TARGET_LINK_LIBRARIES(Calendars-static Qt${QT_VERSION_MAJOR}::Core Qt${QT_VERSION_MAJOR}::Widgets)
SET_TARGET_PROPERTIES(Calendars-static PROPERTIES OUTPUT_NAME "Calendars")
SET_TARGET_PROPERTIES(Calendars-static PROPERTIES COMPILE_FLAGS "-DQT_STATICPLUGIN")
ADD_DEPENDENCIES(AllStaticPlugins Calendars-static)
Expand Down
6 changes: 3 additions & 3 deletions plugins/EquationOfTime/src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,14 @@ SET(EQUATIONOFTIME_UIS
gui/equationOfTimeWindow.ui
)

QT5_WRAP_UI(EQUATIONOFTIME_UIS_H ${EQUATIONOFTIME_UIS})
QT_WRAP_UI(EQUATIONOFTIME_UIS_H ${EQUATIONOFTIME_UIS})

################# compiles resources files ############
SET(EQUATIONOFTIME_RES ../resources/EquationOfTime.qrc)
QT5_ADD_RESOURCES(EQUATIONOFTIME_RES_CXX ${EQUATIONOFTIME_RES})
QT_ADD_RESOURCES(EQUATIONOFTIME_RES_CXX ${EQUATIONOFTIME_RES})

ADD_LIBRARY(EquationOfTime-static STATIC ${EQUATIONOFTIME_SRCS} ${EQUATIONOFTIME_RES_CXX} ${EQUATIONOFTIME_UIS_H})
TARGET_LINK_LIBRARIES(EquationOfTime-static Qt5::Core Qt5::Widgets)
TARGET_LINK_LIBRARIES(EquationOfTime-static Qt${QT_VERSION_MAJOR}::Core Qt${QT_VERSION_MAJOR}::Widgets)
SET_TARGET_PROPERTIES(EquationOfTime-static PROPERTIES OUTPUT_NAME "EquationOfTime")
SET_TARGET_PROPERTIES(EquationOfTime-static PROPERTIES COMPILE_FLAGS "-DQT_STATICPLUGIN")
ADD_DEPENDENCIES(AllStaticPlugins EquationOfTime-static)
Expand Down
6 changes: 3 additions & 3 deletions plugins/Exoplanets/src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,13 @@ SET(Exoplanets_SRCS
SET(ExoplanetsDialog_UIS
gui/exoplanetsDialog.ui
)
QT5_WRAP_UI(ExoplanetsDialog_UIS_H ${ExoplanetsDialog_UIS})
QT_WRAP_UI(ExoplanetsDialog_UIS_H ${ExoplanetsDialog_UIS})

SET(Exoplanets_RES ../resources/Exoplanets.qrc)
QT5_ADD_RESOURCES(Exoplanets_RES_CXX ${Exoplanets_RES})
QT_ADD_RESOURCES(Exoplanets_RES_CXX ${Exoplanets_RES})

ADD_LIBRARY(Exoplanets-static STATIC ${Exoplanets_SRCS} ${Exoplanets_RES_CXX} ${ExoplanetsDialog_UIS_H})
TARGET_LINK_LIBRARIES(Exoplanets-static Qt5::Core Qt5::Network Qt5::Widgets Qt5::Charts)
TARGET_LINK_LIBRARIES(Exoplanets-static Qt${QT_VERSION_MAJOR}::Core Qt${QT_VERSION_MAJOR}::Network Qt${QT_VERSION_MAJOR}::Widgets Qt${QT_VERSION_MAJOR}::Charts)
SET_TARGET_PROPERTIES(Exoplanets-static PROPERTIES OUTPUT_NAME "Exoplanets")
SET_TARGET_PROPERTIES(Exoplanets-static PROPERTIES COMPILE_FLAGS "-DQT_STATICPLUGIN")
ADD_DEPENDENCIES(AllStaticPlugins Exoplanets-static)
Expand Down
2 changes: 1 addition & 1 deletion plugins/HelloStelModule/src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ SET(HelloStelModule_SRCS
ADD_LIBRARY(HelloStelModule-static STATIC ${HelloStelModule_SRCS})
# The library target "HelloStelModule-static" has a default OUTPUT_NAME of "HelloStelModule-static", so change it.
SET_TARGET_PROPERTIES(HelloStelModule-static PROPERTIES OUTPUT_NAME "HelloStelModule")
TARGET_LINK_LIBRARIES(HelloStelModule-static Qt5::Core Qt5::Gui)
TARGET_LINK_LIBRARIES(HelloStelModule-static Qt${QT_VERSION_MAJOR}::Core Qt${QT_VERSION_MAJOR}::Gui)
SET_TARGET_PROPERTIES(HelloStelModule-static PROPERTIES COMPILE_FLAGS "-DQT_STATICPLUGIN")
ADD_DEPENDENCIES(AllStaticPlugins HelloStelModule-static)

Expand Down
6 changes: 3 additions & 3 deletions plugins/MeteorShowers/src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,13 @@ SET(MeteorShowersDialog_UIS
gui/MSSearchDialog.ui
)

QT5_WRAP_UI(MeteorShowersDialog_UIS_H ${MeteorShowersDialog_UIS})
QT_WRAP_UI(MeteorShowersDialog_UIS_H ${MeteorShowersDialog_UIS})

SET(MeteorShowers_RES ../resources/MeteorShower.qrc)
QT5_ADD_RESOURCES(MeteorShowers_RES_CXX ${MeteorShowers_RES})
QT_ADD_RESOURCES(MeteorShowers_RES_CXX ${MeteorShowers_RES})

ADD_LIBRARY(MeteorShowers-static STATIC ${MeteorShowers_SRCS} ${MeteorShowers_MOC_SRCS} ${MeteorShowers_RES_CXX} ${MeteorShowersDialog_UIS_H})
TARGET_LINK_LIBRARIES(MeteorShowers-static Qt5::Core Qt5::Network Qt5::Widgets)
TARGET_LINK_LIBRARIES(MeteorShowers-static Qt${QT_VERSION_MAJOR}::Core Qt${QT_VERSION_MAJOR}::Network Qt${QT_VERSION_MAJOR}::Widgets)
SET_TARGET_PROPERTIES(MeteorShowers-static PROPERTIES OUTPUT_NAME "MeteorShowers")
SET_TARGET_PROPERTIES(MeteorShowers-static PROPERTIES COMPILE_FLAGS "-DQT_STATICPLUGIN")
ADD_DEPENDENCIES(AllStaticPlugins MeteorShowers-static)
Expand Down
6 changes: 3 additions & 3 deletions plugins/NavStars/src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,13 @@ SET(NavStars_UIS
gui/navStarsWindow.ui
)

QT5_WRAP_UI(NavStars_UIS_H ${NavStars_UIS})
QT_WRAP_UI(NavStars_UIS_H ${NavStars_UIS})

SET(NavStars_RES ../resources/NavStars.qrc)
QT5_ADD_RESOURCES(NavStars_RES_CXX ${NavStars_RES})
QT_ADD_RESOURCES(NavStars_RES_CXX ${NavStars_RES})

ADD_LIBRARY(NavStars-static STATIC ${NavStars_SRCS} ${NavStars_RES_CXX} ${NavStars_UIS_H})
TARGET_LINK_LIBRARIES(NavStars-static Qt5::Core Qt5::Widgets)
TARGET_LINK_LIBRARIES(NavStars-static Qt${QT_VERSION_MAJOR}::Core Qt${QT_VERSION_MAJOR}::Widgets)

IF(ENABLE_TESTING)
add_definitions("-DWITH_TESTING_ON")
Expand Down
6 changes: 3 additions & 3 deletions plugins/Novae/src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,13 @@ SET(NovaeDialog_UIS
gui/novaeDialog.ui
)

QT5_WRAP_UI(NovaeDialog_UIS_H ${NovaeDialog_UIS})
QT_WRAP_UI(NovaeDialog_UIS_H ${NovaeDialog_UIS})

SET(Novae_RES ../resources/Novae.qrc)
QT5_ADD_RESOURCES(Novae_RES_CXX ${Novae_RES})
QT_ADD_RESOURCES(Novae_RES_CXX ${Novae_RES})

ADD_LIBRARY(Novae-static STATIC ${Novae_SRCS} ${Novae_RES_CXX} ${NovaeDialog_UIS_H})
TARGET_LINK_LIBRARIES(Novae-static Qt5::Core Qt5::Network Qt5::Widgets)
TARGET_LINK_LIBRARIES(Novae-static Qt${QT_VERSION_MAJOR}::Core Qt${QT_VERSION_MAJOR}::Network Qt${QT_VERSION_MAJOR}::Widgets)
SET_TARGET_PROPERTIES(Novae-static PROPERTIES OUTPUT_NAME "Novae")
SET_TARGET_PROPERTIES(Novae-static PROPERTIES COMPILE_FLAGS "-DQT_STATICPLUGIN")
ADD_DEPENDENCIES(AllStaticPlugins Novae-static)
Expand Down
6 changes: 3 additions & 3 deletions plugins/Observability/src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,14 @@ SET(Observability_SRCS
SET(ObservabilityDialog_UIS
gui/ObservabilityDialog.ui
)
QT5_WRAP_UI(ObservabilityDialog_UIS_H ${ObservabilityDialog_UIS})
QT_WRAP_UI(ObservabilityDialog_UIS_H ${ObservabilityDialog_UIS})


SET(Observability_RES ../Observability.qrc)
QT5_ADD_RESOURCES(Observability_RES_CXX ${Observability_RES})
QT_ADD_RESOURCES(Observability_RES_CXX ${Observability_RES})

ADD_LIBRARY(Observability-static STATIC ${Observability_SRCS} ${Observability_RES_CXX} ${ObservabilityDialog_UIS_H})
TARGET_LINK_LIBRARIES(Observability-static Qt5::Core Qt5::Widgets)
TARGET_LINK_LIBRARIES(Observability-static Qt${QT_VERSION_MAJOR}::Core Qt${QT_VERSION_MAJOR}::Widgets)
SET_TARGET_PROPERTIES(Observability-static PROPERTIES OUTPUT_NAME "Observability")
SET_TARGET_PROPERTIES(Observability-static PROPERTIES COMPILE_FLAGS "-DQT_STATICPLUGIN")
ADD_DEPENDENCIES(AllStaticPlugins Observability-static)
Expand Down
6 changes: 3 additions & 3 deletions plugins/Oculars/src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -26,17 +26,17 @@ SET(Oculars_SRCS
)

SET(Oculars_RES ../resources/Oculars.qrc)
QT5_ADD_RESOURCES(Oculars_RES_CXX ${Oculars_RES})
QT_ADD_RESOURCES(Oculars_RES_CXX ${Oculars_RES})

################# compiles .ui files ############
SET(Oculars_UIS
gui/ocularDialog.ui
)
QT5_WRAP_UI(Oculars_UIS_H ${Oculars_UIS})
QT_WRAP_UI(Oculars_UIS_H ${Oculars_UIS})

ADD_LIBRARY(Oculars-static STATIC ${Oculars_SRCS} ${Oculars_RES_CXX} ${Oculars_UIS_H})
SET_TARGET_PROPERTIES(Oculars-static PROPERTIES OUTPUT_NAME "Oculars")
TARGET_LINK_LIBRARIES(Oculars-static Qt5::Core Qt5::Widgets)
TARGET_LINK_LIBRARIES(Oculars-static Qt${QT_VERSION_MAJOR}::Core Qt${QT_VERSION_MAJOR}::Widgets)
SET_TARGET_PROPERTIES(Oculars-static PROPERTIES COMPILE_FLAGS "-DQT_STATICPLUGIN")
ADD_DEPENDENCIES(AllStaticPlugins Oculars-static)

Expand Down
18 changes: 9 additions & 9 deletions plugins/OnlineQueries/src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -23,27 +23,27 @@ SET(ONLINEQUERIES_UIS
gui/onlineQueriesDialog.ui
)

QT5_WRAP_UI(ONLINEQUERIES_UIS_H ${ONLINEQUERIES_UIS})
QT_WRAP_UI(ONLINEQUERIES_UIS_H ${ONLINEQUERIES_UIS})

IF(ENABLE_QTWEBENGINE)
FIND_PACKAGE(Qt5WebEngine QUIET)
FIND_PACKAGE(Qt5WebEngineWidgets QUIET)
FIND_PACKAGE(Qt${QT_VERSION_MAJOR}WebEngine QUIET)
FIND_PACKAGE(Qt${QT_VERSION_MAJOR}WebEngineWidgets QUIET)
IF(Qt5WebEngine_FOUND AND Qt5WebEngineWidgets_FOUND)
ADD_DEFINITIONS(-DWITH_QTWEBENGINE)
SET(QTWEBENGINE_LIBS Qt5::WebEngine Qt5::WebEngineWidgets)
ELSE(Qt5WebEngine_FOUND AND Qt5WebEngineWidgets_FOUND)
MESSAGE(WARNING "Qt5WebEngine and/or Qt5WebEngineWidgets not found. \
SET(QTWEBENGINE_LIBS Qt${QT_VERSION_MAJOR}::WebEngine Qt${QT_VERSION_MAJOR}::WebEngineWidgets)
ELSE(Qt${QT_VERSION_MAJOR}WebEngine_FOUND AND Qt${QT_VERSION_MAJOR}WebEngineWidgets_FOUND)
MESSAGE(WARNING "Qt${QT_VERSION_MAJOR}WebEngine and/or Qt${QT_VERSION_MAJOR}WebEngineWidgets not found. \
If these packages exist for your platform, install and rerun. \
Else the program will call the system web browser where required.")
ENDIF(Qt5WebEngine_FOUND AND Qt5WebEngineWidgets_FOUND)
ENDIF(Qt${QT_VERSION_MAJOR}WebEngine_FOUND AND Qt${QT_VERSION_MAJOR}WebEngineWidgets_FOUND)
ENDIF(ENABLE_QTWEBENGINE)

################# compiles resources files ############
SET(ONLINEQUERIES_RES ../resources/OnlineQueries.qrc)
QT5_ADD_RESOURCES(ONLINEQUERIES_RES_CXX ${ONLINEQUERIES_RES})
QT_ADD_RESOURCES(ONLINEQUERIES_RES_CXX ${ONLINEQUERIES_RES})

ADD_LIBRARY(OnlineQueries-static STATIC ${ONLINEQUERIES_SRCS} ${ONLINEQUERIES_RES_CXX} ${ONLINEQUERIES_UIS_H})
TARGET_LINK_LIBRARIES(OnlineQueries-static Qt5::Core Qt5::Network Qt5::Widgets ${QTWEBENGINE_LIBS})
TARGET_LINK_LIBRARIES(OnlineQueries-static Qt${QT_VERSION_MAJOR}::Core Qt${QT_VERSION_MAJOR}::Network Qt${QT_VERSION_MAJOR}::Widgets ${QTWEBENGINE_LIBS})
SET_TARGET_PROPERTIES(OnlineQueries-static PROPERTIES OUTPUT_NAME "OnlineQueries")
SET_TARGET_PROPERTIES(OnlineQueries-static PROPERTIES COMPILE_FLAGS "-DQT_STATICPLUGIN")
ADD_DEPENDENCIES(AllStaticPlugins OnlineQueries-static)
Expand Down
Loading

0 comments on commit e90614e

Please sign in to comment.