diff --git a/CMakeLists.txt b/CMakeLists.txt index d70dab026ce..f474b952155 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -65,7 +65,7 @@ if(MSVC) add_compile_options(/wd4573) endif() -find_package(Qt5 +find_package(Qt6 ${IDE_QT_VERSION_MIN} COMPONENTS Concurrent Core Gui Network PrintSupport Qml Sql Widgets Xml Core5Compat ${QT_TEST_COMPONENT} REQUIRED @@ -82,8 +82,8 @@ if (MSVC AND QT_FEATURE_static_runtime) set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded$<$:Debug>") endif() -find_package(Qt5 COMPONENTS LinguistTools QUIET) -find_package(Qt5 COMPONENTS Quick QuickWidgets Designer DesignerComponents Help SerialPort Svg Tools QUIET) +find_package(Qt6 OPTIONAL_COMPONENTS Quick QuickWidgets Designer DesignerComponentsPrivate + Help SerialPort Svg Tools LinguistTools QUIET) find_package(Threads) find_package(Clang QUIET) diff --git a/cmake/FindQt5.cmake b/cmake/FindQt5.cmake deleted file mode 100644 index fc16ec17237..00000000000 --- a/cmake/FindQt5.cmake +++ /dev/null @@ -1,103 +0,0 @@ -#.rst: -# FindQt5 -# ------- -# -# Qt5 wrapper around Qt6 CMake code. -# - -unset(__arguments) -if (Qt5_FIND_QUIETLY) - list(APPEND __arguments QUIET) -endif() -if (Qt5_FIND_REQUIRED) - list(APPEND __arguments REQUIRED) -endif() - -if (Qt5_FIND_COMPONENTS) - # for some reason QUIET doesn't really work when passed to the arguments list - if (Qt5_FIND_QUIETLY) - list(APPEND __arguments OPTIONAL_COMPONENTS) - else() - list(APPEND __arguments COMPONENTS) - endif() -endif() - -find_package(Qt6 ${Qt5_FIND_VERSION} CONFIG COMPONENTS Core QUIET) -if (NOT Qt6_FOUND) - # remove Core5Compat from components to find in Qt5, but add a dummy target, - # which unfortunately cannot start with "Qt6::" - # also remove Tools, where some tools have moved in Qt6, e.g. from Help - list(REMOVE_ITEM Qt5_FIND_COMPONENTS Core5Compat) - list(REMOVE_ITEM Qt5_FIND_COMPONENTS Tools) - find_package(Qt5 ${Qt5_FIND_VERSION} CONFIG ${__arguments} ${Qt5_FIND_COMPONENTS}) - if (NOT TARGET Qt6Core5Compat) - add_library(Qt6Core5Compat INTERFACE) - endif() - - # Remove Qt6 from the not found packages in Qt5 mode - get_property(not_found_packages GLOBAL PROPERTY "PACKAGES_NOT_FOUND") - if(not_found_packages) - list(REMOVE_ITEM not_found_packages Qt6) - set_property(GLOBAL PROPERTY "PACKAGES_NOT_FOUND" "${not_found_packages}") - endif() - return() -else() - # since Qt 6.2 some components are renamed to *Private - foreach(possible_private_libs DesignerComponents QmlDebug) - list(FIND Qt5_FIND_COMPONENTS ${possible_private_libs} dcIndex) - if(dcIndex GREATER_EQUAL 0) - find_package(Qt6${possible_private_libs}Private CONFIG QUIET) - if(TARGET Qt6::${possible_private_libs}Private) - set_property(TARGET Qt6::${possible_private_libs}Private PROPERTY IMPORTED_GLOBAL TRUE) - add_library(Qt5::${possible_private_libs} ALIAS Qt6::${possible_private_libs}Private) - list(REMOVE_AT Qt5_FIND_COMPONENTS ${dcIndex}) - endif() - endif() - endforeach() - find_package(Qt6 CONFIG ${__arguments} ${Qt5_FIND_COMPONENTS}) -endif() - -set(__additional_imported_components ATSPI2_nolink) # Work around QTBUG-97023 -foreach(comp IN LISTS Qt5_FIND_COMPONENTS __additional_imported_components) - if(TARGET Qt6::${comp}) - if (NOT TARGET Qt5::${comp}) - if (NOT QT_FEATURE_static) - set_property(TARGET Qt6::${comp} PROPERTY IMPORTED_GLOBAL TRUE) - endif() - add_library(Qt5::${comp} ALIAS Qt6::${comp}) - endif() - if (TARGET Qt6::${comp}Private AND NOT TARGET Qt5::${comp}Private) - if (NOT QT_FEATURE_static) - set_property(TARGET Qt6::${comp}Private PROPERTY IMPORTED_GLOBAL TRUE) - endif() - add_library(Qt5::${comp}Private ALIAS Qt6::${comp}Private) - endif() - endif() -endforeach() - -# alias Qt6::Core5Compat to Qt6Core5Compat to make consistent with Qt5 path -if (TARGET Qt6::Core5Compat AND NOT TARGET Qt6Core5Compat) - add_library(Qt6Core5Compat ALIAS Qt6::Core5Compat) -endif() - -set(Qt5_FOUND ${Qt6_FOUND}) -set(Qt5_VERSION ${Qt6_VERSION}) - -foreach(tool qmake lrelease lupdate moc rcc qhelpgenerator) - if (TARGET Qt6::${tool} AND NOT TARGET Qt5::${tool}) - add_executable(Qt5::${tool} IMPORTED GLOBAL) - get_target_property(imported_location Qt6::${tool} IMPORTED_LOCATION) - # handle separate tools for each configuration - if (NOT imported_location) - get_target_property(imported_location Qt6::${tool} IMPORTED_LOCATION_RELEASE) - endif() - set_target_properties(Qt5::${tool} PROPERTIES IMPORTED_LOCATION "${imported_location}") - endif() -endforeach() - -if (NOT DEFINED qt5_wrap_cpp) - function(qt5_wrap_cpp outfiles) - qt6_wrap_cpp(${outfiles} ${ARGN}) - set(${outfiles} ${${outfiles}} PARENT_SCOPE) - endfunction() -endif() diff --git a/cmake/QtCreatorAPIInternal.cmake b/cmake/QtCreatorAPIInternal.cmake index efe7efd9ce7..e0e513c9d29 100644 --- a/cmake/QtCreatorAPIInternal.cmake +++ b/cmake/QtCreatorAPIInternal.cmake @@ -224,7 +224,7 @@ function(set_explicit_moc target_name file) set(file_dependencies DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/${target_name}.json") endif() set_property(SOURCE "${file}" PROPERTY SKIP_AUTOMOC ON) - qt5_wrap_cpp(file_moc "${file}" ${file_dependencies}) + qt_wrap_cpp(file_moc "${file}" ${file_dependencies}) target_sources(${target_name} PRIVATE "${file_moc}") endfunction() diff --git a/cmake/QtCreatorDocumentation.cmake b/cmake/QtCreatorDocumentation.cmake index 0dbd46f47a0..3c66ae0947b 100644 --- a/cmake/QtCreatorDocumentation.cmake +++ b/cmake/QtCreatorDocumentation.cmake @@ -10,7 +10,7 @@ add_feature_info("Build online documentation" WITH_ONLINE_DOCS "") # Used for QT_INSTALL_DOCS function(qt5_query_qmake) if (NOT TARGET Qt::qmake) - message(FATAL_ERROR "Qmake was not found. Add find_package(Qt5 COMPONENTS Core) to CMake to enable.") + message(FATAL_ERROR "Qmake was not found. Add find_package(Qt6 COMPONENTS Core) to CMake to enable.") endif() # dummy check for if we already queried qmake if (QT_INSTALL_BINS) @@ -154,7 +154,7 @@ function(_setup_qhelpgenerator_targets _qdocconf_file _html_outputdir) endif() if (NOT TARGET Qt::qhelpgenerator) - message(WARNING "qhelpgenerator missing: No QCH documentation targets were generated. Add find_package(Qt5 COMPONENTS Help) to CMake to enable.") + message(WARNING "qhelpgenerator missing: No QCH documentation targets were generated. Add find_package(Qt6 COMPONENTS Help) to CMake to enable.") return() endif() diff --git a/cmake/QtCreatorTranslations.cmake b/cmake/QtCreatorTranslations.cmake index 80286602ad3..0c1e2e35c5a 100644 --- a/cmake/QtCreatorTranslations.cmake +++ b/cmake/QtCreatorTranslations.cmake @@ -126,7 +126,7 @@ endfunction() function(add_translation_targets file_prefix) if (NOT TARGET Qt::lrelease OR NOT TARGET Qt::lupdate) # No Qt translation tools were found: Skip this directory - message(WARNING "No Qt translation tools found, skipping translation targets. Add find_package(Qt5 COMPONENTS LinguistTools) to CMake to enable.") + message(WARNING "No Qt translation tools found, skipping translation targets. Add find_package(Qt6 COMPONENTS LinguistTools) to CMake to enable.") return() endif() diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index b567bbe120e..792b3012f27 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -36,9 +36,6 @@ install(EXPORT QtCreator ) file(WRITE ${CMAKE_BINARY_DIR}/cmake/QtCreatorConfig.cmake " -\# add module path for special FindQt5.cmake that considers Qt6 too -list(APPEND CMAKE_MODULE_PATH \${CMAKE_CURRENT_LIST_DIR}) - \# force plugins to same path naming conventions as Qt Creator \# otherwise plugins will not be found if(UNIX AND NOT APPLE) @@ -50,10 +47,10 @@ if(UNIX AND NOT APPLE) endif() include(CMakeFindDependencyMacro) -find_dependency(Qt5 ${IDE_QT_VERSION_MIN} +find_dependency(Qt6 ${IDE_QT_VERSION_MIN} COMPONENTS Concurrent Core Gui Widgets Core5Compat Network PrintSupport Qml Sql REQUIRED ) -find_dependency(Qt5 COMPONENTS Quick QuickWidgets QUIET) +find_dependency(Qt6 COMPONENTS Quick QuickWidgets QUIET) if (NOT IDE_VERSION) include(\${CMAKE_CURRENT_LIST_DIR}/QtCreatorIDEBranding.cmake) @@ -87,7 +84,6 @@ file(COPY ${PROJECT_SOURCE_DIR}/cmake/QtCreatorDocumentation.cmake ${PROJECT_SOURCE_DIR}/cmake/QtCreatorAPI.cmake ${PROJECT_SOURCE_DIR}/cmake/QtCreatorAPIInternal.cmake - ${PROJECT_SOURCE_DIR}/cmake/FindQt5.cmake ${PROJECT_SOURCE_DIR}/cmake/Config.cmake.in ${PROJECT_SOURCE_DIR}/cmake/QtcSeparateDebugInfo.cmake ${PROJECT_SOURCE_DIR}/cmake/QtcSeparateDebugInfo.Info.plist.in @@ -102,7 +98,6 @@ install( ${PROJECT_SOURCE_DIR}/cmake/QtCreatorDocumentation.cmake ${PROJECT_SOURCE_DIR}/cmake/QtCreatorAPI.cmake ${PROJECT_SOURCE_DIR}/cmake/QtCreatorAPIInternal.cmake - ${PROJECT_SOURCE_DIR}/cmake/FindQt5.cmake ${PROJECT_SOURCE_DIR}/cmake/Config.cmake.in ${PROJECT_SOURCE_DIR}/cmake/QtcSeparateDebugInfo.cmake ${PROJECT_SOURCE_DIR}/cmake/QtcSeparateDebugInfo.Info.plist.in diff --git a/src/libs/extensionsystem/CMakeLists.txt b/src/libs/extensionsystem/CMakeLists.txt index ea7cb60beb0..0e4e6607a55 100644 --- a/src/libs/extensionsystem/CMakeLists.txt +++ b/src/libs/extensionsystem/CMakeLists.txt @@ -19,7 +19,7 @@ add_qtc_library(ExtensionSystem SKIP_AUTOMOC pluginmanager.cpp ) -find_package(Qt5 COMPONENTS Test QUIET) +find_package(Qt6 COMPONENTS Test QUIET) extend_qtc_library(ExtensionSystem CONDITION TARGET Qt::Test diff --git a/src/libs/utils/CMakeLists.txt b/src/libs/utils/CMakeLists.txt index 76f4e8a314a..34b24ff78c7 100644 --- a/src/libs/utils/CMakeLists.txt +++ b/src/libs/utils/CMakeLists.txt @@ -2,7 +2,7 @@ add_qtc_library(Utils DEPENDS Qt::Qml Qt::Xml PUBLIC_DEPENDS Qt::Concurrent Qt::Core Qt::Network Qt::Gui Qt::Widgets - Qt6Core5Compat + Qt::Core5Compat SOURCES ../3rdparty/span/span.hpp ../3rdparty/tl_expected/include/tl/expected.hpp diff --git a/src/plugins/clangtools/unit-tests/exported-diagnostics/CMakeLists.txt b/src/plugins/clangtools/unit-tests/exported-diagnostics/CMakeLists.txt index 30efc996911..98f9833492d 100644 --- a/src/plugins/clangtools/unit-tests/exported-diagnostics/CMakeLists.txt +++ b/src/plugins/clangtools/unit-tests/exported-diagnostics/CMakeLists.txt @@ -11,7 +11,7 @@ set(CMAKE_AUTORCC ON) set(CMAKE_CXX_STANDARD 11) set(CMAKE_CXX_STANDARD_REQUIRED ON) -find_package(Qt5 COMPONENTS Widgets REQUIRED) +find_package(Qt6 COMPONENTS Widgets REQUIRED) add_executable(clangtools main.cpp diff --git a/src/plugins/haskell/CMakeLists.txt b/src/plugins/haskell/CMakeLists.txt index 8f6cc4f1d85..dcc4bdb4a81 100644 --- a/src/plugins/haskell/CMakeLists.txt +++ b/src/plugins/haskell/CMakeLists.txt @@ -1,7 +1,6 @@ add_qtc_plugin(Haskell PLUGIN_DEPENDS QtCreator::Core QtCreator::TextEditor QtCreator::ProjectExplorer - DEPENDS Qt5::Widgets SOURCES haskell.qrc haskell_global.h diff --git a/src/plugins/help/CMakeLists.txt b/src/plugins/help/CMakeLists.txt index c25f0b6cd5b..d329b2a10aa 100644 --- a/src/plugins/help/CMakeLists.txt +++ b/src/plugins/help/CMakeLists.txt @@ -45,7 +45,7 @@ extend_qtc_plugin(Help ) option(BUILD_HELPVIEWERBACKEND_QTWEBENGINE "Build QtWebEngine based help viewer backend." YES) -find_package(Qt5 COMPONENTS WebEngineWidgets QUIET) +find_package(Qt6 COMPONENTS WebEngineWidgets QUIET) extend_qtc_plugin(Help CONDITION BUILD_HELPVIEWERBACKEND_QTWEBENGINE AND TARGET Qt::WebEngineWidgets FEATURE_INFO "QtWebEngine help viewer" diff --git a/src/plugins/imageviewer/CMakeLists.txt b/src/plugins/imageviewer/CMakeLists.txt index 5c6f0ca98b6..5c027bbd38c 100644 --- a/src/plugins/imageviewer/CMakeLists.txt +++ b/src/plugins/imageviewer/CMakeLists.txt @@ -1,4 +1,4 @@ -find_package(Qt5 COMPONENTS SvgWidgets QUIET) +find_package(Qt6 COMPONENTS SvgWidgets QUIET) if (TARGET Qt::SvgWidgets) set(SVG_WIDGETS Qt::SvgWidgets) endif() diff --git a/tests/auto/debugger/CMakeLists.txt b/tests/auto/debugger/CMakeLists.txt index 5ed44a94d2f..4abe98c05e8 100644 --- a/tests/auto/debugger/CMakeLists.txt +++ b/tests/auto/debugger/CMakeLists.txt @@ -27,7 +27,7 @@ if (NOT QT_CREATOR_API_DEFINED) set(WITH_TESTS ON) - find_package(Qt5 + find_package(Qt6 COMPONENTS Gui Core Core5Compat Widgets Network Qml Concurrent Test Xml MODULE) find_package(Threads) diff --git a/tests/unit/CMakeLists.txt b/tests/unit/CMakeLists.txt index 3a36658ae4f..7baf81f84bd 100644 --- a/tests/unit/CMakeLists.txt +++ b/tests/unit/CMakeLists.txt @@ -30,7 +30,7 @@ if (NOT QT_CREATOR_API_DEFINED) set(GOOGLETEST_DIR ${CMAKE_CURRENT_LIST_DIR}/unittest/3rdparty/googletest) find_package(Clang MODULE) - find_package(Qt5 + find_package(Qt6 COMPONENTS Gui Core Core5Compat Widgets Network Qml Concurrent Test Xml MODULE) find_package(Threads) diff --git a/tests/unit/unittest/CMakeLists.txt b/tests/unit/unittest/CMakeLists.txt index fd73f4cb124..e05c8d3995b 100644 --- a/tests/unit/unittest/CMakeLists.txt +++ b/tests/unit/unittest/CMakeLists.txt @@ -24,7 +24,7 @@ add_qtc_test(unittest GTEST DEPENDS Qt::Core Qt::Network Qt::Widgets Qt::Xml Qt::Concurrent Qt::Qml Qt::Gui - Qt6Core5Compat QmlJS Sqlite SqliteC + Qt::Core5Compat QmlJS Sqlite SqliteC Googletest DEFINES QT_NO_CAST_TO_ASCII