]> granicus.if.org Git - graphviz/commitdiff
CMake: look for and use Qt6 in preference to Qt5
authorMatthew Fernandez <matthew.fernandez@gmail.com>
Sat, 31 Dec 2022 00:23:31 +0000 (16:23 -0800)
committerMatthew Fernandez <matthew.fernandez@gmail.com>
Sat, 31 Dec 2022 17:24:03 +0000 (09:24 -0800)
Gitlab: #2233

CHANGELOG.md
cmd/gvedit/CMakeLists.txt

index 7e288817bc1f53169f3a9193cd3aa31cb0227ebd..85eae01f47bc9a82958a175d14fddae5f7e25999 100644 (file)
@@ -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
 
index e71230405949fd2a1fefb61ba270992b69ac2141..5fdcd76e85eabddb56be22022920c12bec3419a0 100644 (file)
@@ -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})