forked from qt-creator/qt-creator
Build: Remove FindQt5.cmake
No longer needed, since we generally only support building with Qt 6 nowadays, and the parts that still do support building with Qt 5 handle that manually. Change-Id: I72381589ca3ab7bf1af88d9f185cad7f0cdf149c Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: <github-actions-qt-creator@cristianadam.eu> Reviewed-by: Cristian Adam <cristian.adam@qt.io>
This commit is contained in:
@@ -65,7 +65,7 @@ if(MSVC)
|
|||||||
add_compile_options(/wd4573)
|
add_compile_options(/wd4573)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
find_package(Qt5
|
find_package(Qt6
|
||||||
${IDE_QT_VERSION_MIN}
|
${IDE_QT_VERSION_MIN}
|
||||||
COMPONENTS Concurrent Core Gui Network PrintSupport Qml Sql Widgets Xml Core5Compat ${QT_TEST_COMPONENT}
|
COMPONENTS Concurrent Core Gui Network PrintSupport Qml Sql Widgets Xml Core5Compat ${QT_TEST_COMPONENT}
|
||||||
REQUIRED
|
REQUIRED
|
||||||
@@ -82,8 +82,8 @@ if (MSVC AND QT_FEATURE_static_runtime)
|
|||||||
set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>")
|
set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
find_package(Qt5 COMPONENTS LinguistTools QUIET)
|
find_package(Qt6 OPTIONAL_COMPONENTS Quick QuickWidgets Designer DesignerComponentsPrivate
|
||||||
find_package(Qt5 COMPONENTS Quick QuickWidgets Designer DesignerComponents Help SerialPort Svg Tools QUIET)
|
Help SerialPort Svg Tools LinguistTools QUIET)
|
||||||
|
|
||||||
find_package(Threads)
|
find_package(Threads)
|
||||||
find_package(Clang QUIET)
|
find_package(Clang QUIET)
|
||||||
|
@@ -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()
|
|
@@ -224,7 +224,7 @@ function(set_explicit_moc target_name file)
|
|||||||
set(file_dependencies DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/${target_name}.json")
|
set(file_dependencies DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/${target_name}.json")
|
||||||
endif()
|
endif()
|
||||||
set_property(SOURCE "${file}" PROPERTY SKIP_AUTOMOC ON)
|
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}")
|
target_sources(${target_name} PRIVATE "${file_moc}")
|
||||||
endfunction()
|
endfunction()
|
||||||
|
|
||||||
|
@@ -10,7 +10,7 @@ add_feature_info("Build online documentation" WITH_ONLINE_DOCS "")
|
|||||||
# Used for QT_INSTALL_DOCS
|
# Used for QT_INSTALL_DOCS
|
||||||
function(qt5_query_qmake)
|
function(qt5_query_qmake)
|
||||||
if (NOT TARGET Qt::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()
|
endif()
|
||||||
# dummy check for if we already queried qmake
|
# dummy check for if we already queried qmake
|
||||||
if (QT_INSTALL_BINS)
|
if (QT_INSTALL_BINS)
|
||||||
@@ -154,7 +154,7 @@ function(_setup_qhelpgenerator_targets _qdocconf_file _html_outputdir)
|
|||||||
endif()
|
endif()
|
||||||
|
|
||||||
if (NOT TARGET Qt::qhelpgenerator)
|
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()
|
return()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
@@ -126,7 +126,7 @@ endfunction()
|
|||||||
function(add_translation_targets file_prefix)
|
function(add_translation_targets file_prefix)
|
||||||
if (NOT TARGET Qt::lrelease OR NOT TARGET Qt::lupdate)
|
if (NOT TARGET Qt::lrelease OR NOT TARGET Qt::lupdate)
|
||||||
# No Qt translation tools were found: Skip this directory
|
# 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()
|
return()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
@@ -36,9 +36,6 @@ install(EXPORT QtCreator
|
|||||||
)
|
)
|
||||||
|
|
||||||
file(WRITE ${CMAKE_BINARY_DIR}/cmake/QtCreatorConfig.cmake "
|
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
|
\# force plugins to same path naming conventions as Qt Creator
|
||||||
\# otherwise plugins will not be found
|
\# otherwise plugins will not be found
|
||||||
if(UNIX AND NOT APPLE)
|
if(UNIX AND NOT APPLE)
|
||||||
@@ -50,10 +47,10 @@ if(UNIX AND NOT APPLE)
|
|||||||
endif()
|
endif()
|
||||||
|
|
||||||
include(CMakeFindDependencyMacro)
|
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
|
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)
|
if (NOT IDE_VERSION)
|
||||||
include(\${CMAKE_CURRENT_LIST_DIR}/QtCreatorIDEBranding.cmake)
|
include(\${CMAKE_CURRENT_LIST_DIR}/QtCreatorIDEBranding.cmake)
|
||||||
@@ -87,7 +84,6 @@ file(COPY
|
|||||||
${PROJECT_SOURCE_DIR}/cmake/QtCreatorDocumentation.cmake
|
${PROJECT_SOURCE_DIR}/cmake/QtCreatorDocumentation.cmake
|
||||||
${PROJECT_SOURCE_DIR}/cmake/QtCreatorAPI.cmake
|
${PROJECT_SOURCE_DIR}/cmake/QtCreatorAPI.cmake
|
||||||
${PROJECT_SOURCE_DIR}/cmake/QtCreatorAPIInternal.cmake
|
${PROJECT_SOURCE_DIR}/cmake/QtCreatorAPIInternal.cmake
|
||||||
${PROJECT_SOURCE_DIR}/cmake/FindQt5.cmake
|
|
||||||
${PROJECT_SOURCE_DIR}/cmake/Config.cmake.in
|
${PROJECT_SOURCE_DIR}/cmake/Config.cmake.in
|
||||||
${PROJECT_SOURCE_DIR}/cmake/QtcSeparateDebugInfo.cmake
|
${PROJECT_SOURCE_DIR}/cmake/QtcSeparateDebugInfo.cmake
|
||||||
${PROJECT_SOURCE_DIR}/cmake/QtcSeparateDebugInfo.Info.plist.in
|
${PROJECT_SOURCE_DIR}/cmake/QtcSeparateDebugInfo.Info.plist.in
|
||||||
@@ -102,7 +98,6 @@ install(
|
|||||||
${PROJECT_SOURCE_DIR}/cmake/QtCreatorDocumentation.cmake
|
${PROJECT_SOURCE_DIR}/cmake/QtCreatorDocumentation.cmake
|
||||||
${PROJECT_SOURCE_DIR}/cmake/QtCreatorAPI.cmake
|
${PROJECT_SOURCE_DIR}/cmake/QtCreatorAPI.cmake
|
||||||
${PROJECT_SOURCE_DIR}/cmake/QtCreatorAPIInternal.cmake
|
${PROJECT_SOURCE_DIR}/cmake/QtCreatorAPIInternal.cmake
|
||||||
${PROJECT_SOURCE_DIR}/cmake/FindQt5.cmake
|
|
||||||
${PROJECT_SOURCE_DIR}/cmake/Config.cmake.in
|
${PROJECT_SOURCE_DIR}/cmake/Config.cmake.in
|
||||||
${PROJECT_SOURCE_DIR}/cmake/QtcSeparateDebugInfo.cmake
|
${PROJECT_SOURCE_DIR}/cmake/QtcSeparateDebugInfo.cmake
|
||||||
${PROJECT_SOURCE_DIR}/cmake/QtcSeparateDebugInfo.Info.plist.in
|
${PROJECT_SOURCE_DIR}/cmake/QtcSeparateDebugInfo.Info.plist.in
|
||||||
|
@@ -19,7 +19,7 @@ add_qtc_library(ExtensionSystem
|
|||||||
SKIP_AUTOMOC pluginmanager.cpp
|
SKIP_AUTOMOC pluginmanager.cpp
|
||||||
)
|
)
|
||||||
|
|
||||||
find_package(Qt5 COMPONENTS Test QUIET)
|
find_package(Qt6 COMPONENTS Test QUIET)
|
||||||
|
|
||||||
extend_qtc_library(ExtensionSystem
|
extend_qtc_library(ExtensionSystem
|
||||||
CONDITION TARGET Qt::Test
|
CONDITION TARGET Qt::Test
|
||||||
|
@@ -2,7 +2,7 @@ add_qtc_library(Utils
|
|||||||
DEPENDS Qt::Qml Qt::Xml
|
DEPENDS Qt::Qml Qt::Xml
|
||||||
PUBLIC_DEPENDS
|
PUBLIC_DEPENDS
|
||||||
Qt::Concurrent Qt::Core Qt::Network Qt::Gui Qt::Widgets
|
Qt::Concurrent Qt::Core Qt::Network Qt::Gui Qt::Widgets
|
||||||
Qt6Core5Compat
|
Qt::Core5Compat
|
||||||
SOURCES
|
SOURCES
|
||||||
../3rdparty/span/span.hpp
|
../3rdparty/span/span.hpp
|
||||||
../3rdparty/tl_expected/include/tl/expected.hpp
|
../3rdparty/tl_expected/include/tl/expected.hpp
|
||||||
|
@@ -11,7 +11,7 @@ set(CMAKE_AUTORCC ON)
|
|||||||
set(CMAKE_CXX_STANDARD 11)
|
set(CMAKE_CXX_STANDARD 11)
|
||||||
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
||||||
|
|
||||||
find_package(Qt5 COMPONENTS Widgets REQUIRED)
|
find_package(Qt6 COMPONENTS Widgets REQUIRED)
|
||||||
|
|
||||||
add_executable(clangtools
|
add_executable(clangtools
|
||||||
main.cpp
|
main.cpp
|
||||||
|
@@ -1,7 +1,6 @@
|
|||||||
add_qtc_plugin(Haskell
|
add_qtc_plugin(Haskell
|
||||||
PLUGIN_DEPENDS
|
PLUGIN_DEPENDS
|
||||||
QtCreator::Core QtCreator::TextEditor QtCreator::ProjectExplorer
|
QtCreator::Core QtCreator::TextEditor QtCreator::ProjectExplorer
|
||||||
DEPENDS Qt5::Widgets
|
|
||||||
SOURCES
|
SOURCES
|
||||||
haskell.qrc
|
haskell.qrc
|
||||||
haskell_global.h
|
haskell_global.h
|
||||||
|
@@ -45,7 +45,7 @@ extend_qtc_plugin(Help
|
|||||||
)
|
)
|
||||||
|
|
||||||
option(BUILD_HELPVIEWERBACKEND_QTWEBENGINE "Build QtWebEngine based help viewer backend." YES)
|
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
|
extend_qtc_plugin(Help
|
||||||
CONDITION BUILD_HELPVIEWERBACKEND_QTWEBENGINE AND TARGET Qt::WebEngineWidgets
|
CONDITION BUILD_HELPVIEWERBACKEND_QTWEBENGINE AND TARGET Qt::WebEngineWidgets
|
||||||
FEATURE_INFO "QtWebEngine help viewer"
|
FEATURE_INFO "QtWebEngine help viewer"
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
find_package(Qt5 COMPONENTS SvgWidgets QUIET)
|
find_package(Qt6 COMPONENTS SvgWidgets QUIET)
|
||||||
if (TARGET Qt::SvgWidgets)
|
if (TARGET Qt::SvgWidgets)
|
||||||
set(SVG_WIDGETS Qt::SvgWidgets)
|
set(SVG_WIDGETS Qt::SvgWidgets)
|
||||||
endif()
|
endif()
|
||||||
|
@@ -27,7 +27,7 @@ if (NOT QT_CREATOR_API_DEFINED)
|
|||||||
|
|
||||||
set(WITH_TESTS ON)
|
set(WITH_TESTS ON)
|
||||||
|
|
||||||
find_package(Qt5
|
find_package(Qt6
|
||||||
COMPONENTS
|
COMPONENTS
|
||||||
Gui Core Core5Compat Widgets Network Qml Concurrent Test Xml MODULE)
|
Gui Core Core5Compat Widgets Network Qml Concurrent Test Xml MODULE)
|
||||||
find_package(Threads)
|
find_package(Threads)
|
||||||
|
@@ -30,7 +30,7 @@ if (NOT QT_CREATOR_API_DEFINED)
|
|||||||
set(GOOGLETEST_DIR ${CMAKE_CURRENT_LIST_DIR}/unittest/3rdparty/googletest)
|
set(GOOGLETEST_DIR ${CMAKE_CURRENT_LIST_DIR}/unittest/3rdparty/googletest)
|
||||||
|
|
||||||
find_package(Clang MODULE)
|
find_package(Clang MODULE)
|
||||||
find_package(Qt5
|
find_package(Qt6
|
||||||
COMPONENTS
|
COMPONENTS
|
||||||
Gui Core Core5Compat Widgets Network Qml Concurrent Test Xml MODULE)
|
Gui Core Core5Compat Widgets Network Qml Concurrent Test Xml MODULE)
|
||||||
find_package(Threads)
|
find_package(Threads)
|
||||||
|
@@ -24,7 +24,7 @@ add_qtc_test(unittest GTEST
|
|||||||
DEPENDS
|
DEPENDS
|
||||||
Qt::Core Qt::Network Qt::Widgets
|
Qt::Core Qt::Network Qt::Widgets
|
||||||
Qt::Xml Qt::Concurrent Qt::Qml Qt::Gui
|
Qt::Xml Qt::Concurrent Qt::Qml Qt::Gui
|
||||||
Qt6Core5Compat QmlJS Sqlite SqliteC
|
Qt::Core5Compat QmlJS Sqlite SqliteC
|
||||||
Googletest
|
Googletest
|
||||||
DEFINES
|
DEFINES
|
||||||
QT_NO_CAST_TO_ASCII
|
QT_NO_CAST_TO_ASCII
|
||||||
|
Reference in New Issue
Block a user