From: Matthew Fernandez Date: Sat, 31 Dec 2022 00:23:31 +0000 (-0800) Subject: CMake: look for and use Qt6 in preference to Qt5 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=743aed2fea0206827294c9efa6ab117a2ba8dceb;p=graphviz CMake: look for and use Qt6 in preference to Qt5 Gitlab: #2233 --- diff --git a/CHANGELOG.md b/CHANGELOG.md index 7e288817b..85eae01f4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - The Autotools build system no longer looks for `python` binaries. The Python interpreter is unconditionally assumed to be `python3`. The configure option `--enable-python` is now an alias for `--enable-python3`. +- The CMake build system, when building `gvedit`, will now look for and use Qt6 + in preference over Qt5. #2233 ### Fixed diff --git a/cmd/gvedit/CMakeLists.txt b/cmd/gvedit/CMakeLists.txt index e71230405..5fdcd76e8 100644 --- a/cmd/gvedit/CMakeLists.txt +++ b/cmd/gvedit/CMakeLists.txt @@ -1,5 +1,11 @@ if(with_gvedit) - find_package(Qt5 COMPONENTS Core PrintSupport Widgets REQUIRED) + find_package(Qt6 COMPONENTS Core PrintSupport Widgets) + if(Qt6_FOUND) + set(QT_LIBS Qt6::Core Qt6::PrintSupport Qt6::Widgets) + else() + find_package(Qt5 COMPONENTS Core PrintSupport Widgets REQUIRED) + set(QT_LIBS Qt5::Core Qt5::PrintSupport Qt5::Widgets) + endif() add_executable(gvedit csettings.cpp @@ -34,7 +40,7 @@ if(with_gvedit) gvc ) - target_link_libraries(gvedit PRIVATE Qt5::Core Qt5::PrintSupport Qt5::Widgets) + target_link_libraries(gvedit PRIVATE ${QT_LIBS}) if(EXPAT_FOUND) target_include_directories(gvedit SYSTEM PRIVATE ${EXPAT_INCLUDE_DIRS})