From b6cc1916d42c24489bcdb869abd7f7425cf25a04 Mon Sep 17 00:00:00 2001 From: dsm <41967334+dsm@users.noreply.github.com> Date: Mon, 13 Feb 2023 22:20:42 +0300 Subject: [PATCH] remove versionless cmake function usage --- qucs/components/CMakeLists.txt | 9 ++++++++- qucs/diagrams/CMakeLists.txt | 7 ++++++- qucs/dialogs/CMakeLists.txt | 12 ++++++++++-- qucs/extsimkernels/CMakeLists.txt | 8 +++++++- qucs/paintings/CMakeLists.txt | 8 +++++++- qucs/qt3_compat/CMakeLists.txt | 8 +++++++- translations/CMakeLists.txt | 13 +++++++++++-- 7 files changed, 56 insertions(+), 9 deletions(-) diff --git a/qucs/components/CMakeLists.txt b/qucs/components/CMakeLists.txt index b15191bc..6bc50025 100644 --- a/qucs/components/CMakeLists.txt +++ b/qucs/components/CMakeLists.txt @@ -265,7 +265,14 @@ optimizedialog.h spicefile.h ) -qt_wrap_cpp(COMPONENTS_MOC_SRCS ${COMPONENTS_MOC_HDRS}) +find_package(QT NAMES Qt6 Qt5 REQUIRED COMPONENTS Core) + +IF(QT_VERSION_MAJOR EQUAL 6) + qt6_wrap_cpp(COMPONENTS_MOC_SRCS ${COMPONENTS_MOC_HDRS}) +else() + qt5_wrap_cpp(COMPONENTS_MOC_SRCS ${COMPONENTS_MOC_HDRS}) +endif() + ADD_LIBRARY(components STATIC ${COMPONENTS_HDRS} ${COMPONENTS_SRCS} ${COMPONENTS_MOC_SRCS} ) diff --git a/qucs/diagrams/CMakeLists.txt b/qucs/diagrams/CMakeLists.txt index eda566a5..07765fbd 100755 --- a/qucs/diagrams/CMakeLists.txt +++ b/qucs/diagrams/CMakeLists.txt @@ -33,7 +33,12 @@ SET(DIAGRAMS_MOC_HDRS diagramdialog.h markerdialog.h ) +find_package(QT NAMES Qt6 Qt5 REQUIRED COMPONENTS Core) -qt_wrap_cpp( DIAGRAMS_MOC_SRCS ${DIAGRAMS_MOC_HDRS} ) +IF(QT_VERSION_MAJOR EQUAL 6) + qt6_wrap_cpp( DIAGRAMS_MOC_SRCS ${DIAGRAMS_MOC_HDRS} ) +else() + qt5_wrap_cpp( DIAGRAMS_MOC_SRCS ${DIAGRAMS_MOC_HDRS} ) +endif() ADD_LIBRARY(diagrams STATIC ${DIAGRAMS_HDRS} ${DIAGRAMS_SRCS} ${DIAGRAMS_MOC_SRCS}) diff --git a/qucs/dialogs/CMakeLists.txt b/qucs/dialogs/CMakeLists.txt index 0ef1f815..7777f91d 100755 --- a/qucs/dialogs/CMakeLists.txt +++ b/qucs/dialogs/CMakeLists.txt @@ -69,7 +69,15 @@ SET(DIALOGS_UIC_HDRS searchdialog.ui ) -QT_WRAP_CPP( DIALOGS_MOC_SRCS ${DIALOGS_MOC_HDRS} ) -QT_WRAP_UI( DIALOGS_UIC_SRCS ${DIALOGS_UIC_HDRS} ) +find_package(QT NAMES Qt6 Qt5 REQUIRED COMPONENTS Core) + +IF(QT_VERSION_MAJOR EQUAL 6) + QT6_WRAP_CPP( DIALOGS_MOC_SRCS ${DIALOGS_MOC_HDRS} ) + QT6_WRAP_UI( DIALOGS_UIC_SRCS ${DIALOGS_UIC_HDRS} ) +else() + QT5_WRAP_CPP( DIALOGS_MOC_SRCS ${DIALOGS_MOC_HDRS} ) + QT5_WRAP_UI( DIALOGS_UIC_SRCS ${DIALOGS_UIC_HDRS} ) + +endif() ADD_LIBRARY(dialogs STATIC ${DIALOGS_HDRS} ${DIALOGS_SRCS} ${DIALOGS_MOC_SRCS} ${DIALOGS_UIC_SRCS}) diff --git a/qucs/extsimkernels/CMakeLists.txt b/qucs/extsimkernels/CMakeLists.txt index 7b31e7fe..71e26f6b 100755 --- a/qucs/extsimkernels/CMakeLists.txt +++ b/qucs/extsimkernels/CMakeLists.txt @@ -43,8 +43,14 @@ customsimdialog.h simsettingsdialog.h ) +find_package(QT NAMES Qt6 Qt5 REQUIRED COMPONENTS Core) + +IF(QT_VERSION_MAJOR EQUAL 6) + QT6_WRAP_CPP( EXTSIMKERNELS_MOC_SRCS ${EXTSIMKERNELS_MOC_HDRS} ) +else() + QT5_WRAP_CPP( EXTSIMKERNELS_MOC_SRCS ${EXTSIMKERNELS_MOC_HDRS} ) +endif() -QT_WRAP_CPP( EXTSIMKERNELS_MOC_SRCS ${EXTSIMKERNELS_MOC_HDRS} ) ADD_LIBRARY(extsimkernels STATIC ${EXTSIMKERNELS_HDRS} ${EXTSIMKERNELS_SRCS} ${EXTSIMKERNELS_MOC_SRCS}) diff --git a/qucs/paintings/CMakeLists.txt b/qucs/paintings/CMakeLists.txt index 5069c8fd..b88a8787 100755 --- a/qucs/paintings/CMakeLists.txt +++ b/qucs/paintings/CMakeLists.txt @@ -38,7 +38,13 @@ graphictextdialog.h id_dialog.h ) -QT_WRAP_CPP( PAINTINGS_MOC_SRCS ${PAINTINGS_MOC_HDRS} ) +find_package(QT NAMES Qt6 Qt5 REQUIRED COMPONENTS Core) + +IF(QT_VERSION_MAJOR EQUAL 6) + QT6_WRAP_CPP( PAINTINGS_MOC_SRCS ${PAINTINGS_MOC_HDRS} ) +else() + QT5_WRAP_CPP( PAINTINGS_MOC_SRCS ${PAINTINGS_MOC_HDRS} ) +endif() ADD_LIBRARY(paintings STATIC ${PAINTINGS_HDRS} ${PAINTINGS_SRCS} ${PAINTINGS_MOC_SRCS} ) diff --git a/qucs/qt3_compat/CMakeLists.txt b/qucs/qt3_compat/CMakeLists.txt index 3a3fa703..efe0dc7a 100755 --- a/qucs/qt3_compat/CMakeLists.txt +++ b/qucs/qt3_compat/CMakeLists.txt @@ -30,6 +30,12 @@ q3scrollview.h q3frame.h ) -qt_wrap_cpp( QT3_COMPAT_SRCS ${QT3_COMPAT_MOC_HDRS} ) +find_package(QT NAMES Qt6 Qt5 REQUIRED COMPONENTS Core) + +IF(QT_VERSION_MAJOR EQUAL 6) + QT6_WRAP_CPP( QT3_COMPAT_SRCS ${QT3_COMPAT_MOC_HDRS} ) +else() + QT5_WRAP_CPP( QT3_COMPAT_SRCS ${QT3_COMPAT_MOC_HDRS} ) +endif() ADD_LIBRARY(qt3_compat STATIC ${QT3_COMPAT_HDRS} ${QT3_COMPAT_SRCS}) diff --git a/translations/CMakeLists.txt b/translations/CMakeLists.txt index fddc672d..4aa488e3 100644 --- a/translations/CMakeLists.txt +++ b/translations/CMakeLists.txt @@ -13,12 +13,21 @@ file (GLOB TRANSLATIONS_FILES qucs_*.ts) # WARNING: make clean might delete the source .ts files! Danger! option (UPDATE_TRANSLATIONS "Update source translation translations/*.ts" "OFF") +find_package(QT NAMES Qt6 Qt5 REQUIRED COMPONENTS Core) +IF(QT_VERSION_MAJOR EQUAL 6) IF (UPDATE_TRANSLATIONS) - QT_CREATE_TRANSLATION ( QM_FILES ${FILES_TO_TRANSLATE} ${TRANSLATIONS_FILES}) + QT6_CREATE_TRANSLATION ( QM_FILES ${FILES_TO_TRANSLATE} ${TRANSLATIONS_FILES}) ELSE (UPDATE_TRANSLATIONS) - QT_ADD_TRANSLATION ( QM_FILES ${TRANSLATIONS_FILES}) + QT6_ADD_TRANSLATION ( QM_FILES ${TRANSLATIONS_FILES}) ENDIF (UPDATE_TRANSLATIONS) +ELSE() +IF (UPDATE_TRANSLATIONS) + QT5_CREATE_TRANSLATION ( QM_FILES ${FILES_TO_TRANSLATE} ${TRANSLATIONS_FILES}) +ELSE (UPDATE_TRANSLATIONS) + QT5_ADD_TRANSLATION ( QM_FILES ${TRANSLATIONS_FILES}) +ENDIF (UPDATE_TRANSLATIONS) +ENDIF() ADD_CUSTOM_TARGET (translations ALL DEPENDS ${QM_FILES})