-
Notifications
You must be signed in to change notification settings - Fork 519
Updates for Qt6 #1058
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Updates for Qt6 #1058
Changes from 1 commit
b494bfb
81f0ed9
a1dc58e
4feeab3
420bd39
a4c379f
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -150,7 +150,7 @@ macro(ctkMacroBuildPlugin) | |
| # Add Qt include dirs and defines | ||
| include(${QT_USE_FILE}) | ||
| else() | ||
| find_package(Qt5 COMPONENTS LinguistTools REQUIRED) | ||
| find_package(Qt${CTK_QT_VERSION} COMPONENTS LinguistTools REQUIRED) | ||
| endif() | ||
|
|
||
| # Add the library directories from the external project | ||
|
|
@@ -316,16 +316,16 @@ macro(ctkMacroBuildPlugin) | |
| endforeach() | ||
| endif() | ||
| else() | ||
| find_package(Qt5LinguistTools REQUIRED) | ||
| find_package(Qt${CTK_QT_VERSION}LinguistTools REQUIRED) | ||
| endif() | ||
|
|
||
| if(MY_TEST_PLUGIN AND CTK_QT_VERSION VERSION_GREATER "4") | ||
| find_package(Qt5Test REQUIRED) | ||
| if(CMAKE_VERSION VERSION_LESS 2.8.12) | ||
| target_link_libraries(${lib_name} Qt5::Test) | ||
| else() | ||
| target_link_libraries(${lib_name} PRIVATE Qt5::Test) | ||
| endif() | ||
| find_package(Qt${CTK_QT_VERSION} Test REQUIRED) | ||
| if(CMAKE_VERSION VERSION_LESS 2.8.12) | ||
| target_link_libraries(${lib_name} Qt::Test) | ||
| else() | ||
| target_link_libraries(${lib_name} PRIVATE Qt::Test) | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Here you've switch from Re https://doc.qt.io/qt-6/cmake-qt5-and-qt6-compatibility.html#versionless-targets Re https://doc.qt.io/qt-6/cmake-qt5-and-qt6-compatibility.html#supporting-older-qt-5-versions Could you instead utilize
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I didn't know that it was only for qt 5.15+ for the versionless targets. I'll fix them.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I see you've made some changes with the versioned target, though I still see this specific place in the code and some other places with only a versionless target being used like |
||
| endif() | ||
| endif() | ||
|
|
||
| # Set the output directory for the plugin | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,92 @@ | ||
| ########################################################################### | ||
|
EricAtORS marked this conversation as resolved.
Outdated
|
||
| # | ||
| # Library: CTK | ||
| # | ||
| # Copyright (c) Kitware Inc. | ||
| # | ||
| # Licensed under the Apache License, Version 2.0 (the "License"); | ||
| # you may not use this file except in compliance with the License. | ||
| # You may obtain a copy of the License at | ||
| # | ||
| # http://www.apache.org/licenses/LICENSE-2.0.txt | ||
| # | ||
| # Unless required by applicable law or agreed to in writing, software | ||
| # distributed under the License is distributed on an "AS IS" BASIS, | ||
| # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| # See the License for the specific language governing permissions and | ||
| # limitations under the License. | ||
| # | ||
| ########################################################################### | ||
|
|
||
| #! \ingroup CMakeUtilities | ||
| macro(ctkMacroSetupQt) | ||
| set(CTK_QT_VERSION "4" CACHE STRING "Expected Qt version") | ||
| mark_as_advanced(CTK_QT_VERSION) | ||
|
|
||
| set_property(CACHE CTK_QT_VERSION PROPERTY STRINGS 4 5) | ||
|
|
||
| if(NOT (CTK_QT_VERSION VERSION_EQUAL "4" OR CTK_QT_VERSION VERSION_EQUAL "5")) | ||
| message(FATAL_ERROR "Expected value for CTK_QT_VERSION is either '4' or '5'") | ||
| endif() | ||
|
|
||
|
|
||
| if(CTK_QT_VERSION VERSION_GREATER "4") | ||
| cmake_minimum_required(VERSION 2.8.12) | ||
| find_package(Qt5 COMPONENTS Core) | ||
| set(CTK_QT5_COMPONENTS Core Xml XmlPatterns Concurrent Sql Test Multimedia) | ||
| if(CTK_ENABLE_Widgets OR CTK_LIB_Widgets OR CTK_LIB_CommandLineModules/Frontend/QtGui OR CTK_BUILD_ALL OR CTK_BUILD_ALL_LIBRARIES) | ||
| list(APPEND CTK_QT5_COMPONENTS Widgets OpenGL UiTools) | ||
| endif() | ||
| if(CTK_LIB_CommandLineModules/Frontend/QtWebKit OR CTK_BUILD_ALL OR CTK_BUILD_ALL_LIBRARIES) | ||
| if(TARGET Qt5::WebKitWidgets) | ||
| list(APPEND CTK_QT5_COMPONENTS WebKitWidgets) | ||
| else() | ||
| list(APPEND CTK_QT5_COMPONENTS WebEngineWidgets) | ||
| endif() | ||
| endif() | ||
| if(CTK_LIB_XNAT/Core OR CTK_BUILD_ALL OR CTK_BUILD_ALL_LIBRARIES) | ||
| list(APPEND CTK_QT5_COMPONENTS Script) | ||
| endif() | ||
| find_package(Qt5 COMPONENTS ${CTK_QT5_COMPONENTS} REQUIRED) | ||
|
|
||
| mark_as_superbuild(Qt5_DIR) # Qt 5 | ||
|
|
||
| # XXX Backward compatible way | ||
| if(DEFINED CMAKE_PREFIX_PATH) | ||
| mark_as_superbuild(CMAKE_PREFIX_PATH) # Qt 5 | ||
| endif() | ||
|
|
||
| else() | ||
| set(minimum_required_qt_version "4.6") | ||
|
|
||
| find_package(Qt4) | ||
|
|
||
| if(QT4_FOUND) | ||
|
|
||
| if("${QT_VERSION_MAJOR}.${QT_VERSION_MINOR}" VERSION_LESS "${minimum_required_qt_version}") | ||
| message(FATAL_ERROR "error: CTK requires Qt >= ${minimum_required_qt_version} -- you cannot use Qt ${QT_VERSION_MAJOR}.${QT_VERSION_MINOR}.${QT_VERSION_PATCH}.") | ||
| endif() | ||
|
|
||
| set(QT_USE_QTNETWORK ON) | ||
| set(QT_USE_QTSQL ON) | ||
| set(QT_USE_QTOPENGL ON) | ||
| set(QT_USE_QTXML ON) | ||
| set(QT_USE_QTXMLPATTERNS ON) | ||
| set(QT_USE_QTTEST ${BUILD_TESTING}) | ||
| include(${QT_USE_FILE}) | ||
|
|
||
| # Set variable QT_INSTALLED_LIBRARY_DIR that will contains | ||
| # Qt shared library | ||
| set(QT_INSTALLED_LIBRARY_DIR ${QT_LIBRARY_DIR}) | ||
| if(WIN32) | ||
| get_filename_component(QT_INSTALLED_LIBRARY_DIR ${QT_QMAKE_EXECUTABLE} PATH) | ||
| endif() | ||
|
|
||
| mark_as_superbuild(QT_QMAKE_EXECUTABLE) # Qt 4 | ||
| else() | ||
| message(FATAL_ERROR "error: Qt4 was not found on your system. You probably need to set the QT_QMAKE_EXECUTABLE variable") | ||
| endif() | ||
| endif() | ||
|
|
||
| mark_as_superbuild(CTK_QT_VERSION) | ||
| endmacro() | ||
Uh oh!
There was an error while loading. Please reload this page.