Browse Source

Build with Qt5 if it is found.

Stephen Kelly 13 years ago
parent
commit
25a4f56754
1 changed files with 23 additions and 6 deletions
  1. 23 6
      Source/QtDialog/CMakeLists.txt

+ 23 - 6
Source/QtDialog/CMakeLists.txt

@@ -9,16 +9,33 @@
 # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 # See the License for more information.
 #=============================================================================
+
 project(QtDialog)
-set(QT_MIN_VERSION "4.4.0")
-find_package(Qt4 REQUIRED)
+find_package(Qt5Widgets QUIET)
+if (Qt5Widgets_FOUND)
+  include_directories(${Qt5Widgets_INCLUDE_DIRS})
+  add_definitions(${Qt5Widgets_DEFINITONS})
+  macro(qt4_wrap_ui)
+    qt5_wrap_ui(${ARGN})
+  endmacro()
+  macro(qt4_wrap_cpp)
+    qt5_wrap_cpp(${ARGN})
+  endmacro()
+  macro(qt4_add_resources)
+    qt5_add_resources(${ARGN})
+  endmacro()
+  set(QT_LIBRARIES ${Qt5Widgets_LIBRARIES})
+else()
+  set(QT_MIN_VERSION "4.4.0")
+  find_package(Qt4 REQUIRED)
+  if(NOT QT4_FOUND)
+    message(SEND_ERROR "Failed to find Qt 4.4 or greater.")
+    return()
+  endif()
 
-if(NOT QT4_FOUND)
-  message(SEND_ERROR "Failed to find Qt 4.4 or greater.")
-  return()
+  include(${QT_USE_FILE})
 endif()
 
-include(${QT_USE_FILE})
 set(SRCS
   AddCacheEntry.cxx
   AddCacheEntry.h