]> Creatis software - clitk.git/blobdiff - vv/CMakeLists.txt
First Modification for Qt5 & VTK6
[clitk.git] / vv / CMakeLists.txt
index df4081e5883ac1f69f813e40d278065651842b5d..11c3b1f805cb1824426604dba1d941fc0900e771 100644 (file)
@@ -106,11 +106,14 @@ set(vv_SRCS
 
 #=========================================================
 # Qt related commands
-find_package(Qt4 REQUIRED)
-link_directories(${QT_LIBRARY_DIR})
+find_package(Qt5Widgets REQUIRED)
+find_package(Qt5Network REQUIRED)
+find_package(Qt5Designer REQUIRED)
+link_directories(${QT5Widgets_LIBRARIES})
+link_directories(${QT5Network_LIBRARIES})
+link_directories(${QT5Designer_LIBRARIES})
 
-
-QT4_WRAP_CPP(vv_SRCS
+qt5_wrap_cpp(vv_SRCS
   vvMainWindowBase.h
   QTreePushButton.h
   vvDocumentation.h
@@ -122,14 +125,14 @@ QT4_WRAP_CPP(vv_SRCS
   vvToolCreatorBase.h
   )
 
-QT4_WRAP_UI(vv_UI_CXX
+qt5_wrap_ui(vv_UI_CXX
   qt_ui/vvHelpDialog.ui
   qt_ui/vvDocumentation.ui
   qt_ui/vvDicomSeriesSelector.ui
   qt_ui/vvDummyWindow.ui #For testing
   )
 
-QT4_ADD_RESOURCES(vv_SRCS vvIcons.qrc)
+QT5_add_resources(vv_SRCS vvIcons.qrc)
 
 # Add the autotools in the header vvToolsList.h for initialization of the dummy
 # variables in vv.cxx for the tools contained in vvLib
@@ -145,25 +148,25 @@ endif(${CMAKE_CURRENT_SOURCE_DIR}/CMakeLists.txt IS_NEWER_THAN ${CMAKE_CURRENT_B
 # Add the autotools and the common files ui
 foreach(tool ${vv_TOOLS} ${vv_COMMON_WITH_UI})
     set(vv_SRCS ${vv_SRCS} ${tool}.cxx)
-    QT4_WRAP_CPP(vv_SRCS ${tool}.h)
-    QT4_WRAP_UI(vv_UI_CXX qt_ui/${tool}.ui)
+    QT5_WRAP_CPP(vv_SRCS ${tool}.h)
+    QT5_WRAP_UI(vv_UI_CXX qt_ui/${tool}.ui)
 endforeach(tool)
 
 # Add the common source files
 foreach(tool ${vv_COMMON})
     set(vv_SRCS ${vv_SRCS} ${tool}.cxx)
-    QT4_WRAP_CPP(vv_SRCS ${tool}.h)
+    QT5_WRAP_CPP(vv_SRCS ${tool}.h)
 endforeach(tool)
 
 # if Windows and Qt was built as a static lib then don't set QT_DLL flag
 set(QT_STATIC 0)
 if(WIN32)
-  if(EXISTS ${QT_LIBRARY_DIR}/QtCore.prl)
-    file(READ ${QT_LIBRARY_DIR}/QtCore.prl QT_CORE_PRL)
+  if(EXISTS ${Qt5Widgets_LIBRARIES}/QtCore.prl)
+    file(READ ${Qt5Widgets_LIBRARIES}/QtCore.prl QT_CORE_PRL)
     if(${QT_CORE_PRL} MATCHES "static")
       set(QT_STATIC 1)
     endif(${QT_CORE_PRL} MATCHES "static")
-  endif(EXISTS ${QT_LIBRARY_DIR}/QtCore.prl)
+  endif(EXISTS ${Qt5Widgets_LIBRARIES}/QtCore.prl)
 endif(WIN32)
 if(NOT QT_STATIC)
   add_definitions(-DQT_DLL)
@@ -172,10 +175,11 @@ endif(NOT QT_STATIC)
 add_definitions(-DQT_THREAD_SUPPORT)
 
 include_directories(
-  ${QT_INCLUDES}
-  ${QT_INCLUDE_DIR}
-  ${QT_QTGUI_INCLUDE_DIR}
-  ${QT_QTCORE_INCLUDE_DIR}
+  ${Qt5Widgets_INCLUDE_DIRS}
+  ${Qt5GUI_INCLUDE_DIRS}
+  ${Qt5CORE_INCLUDE_DIRS}
+  ${Qt5Network_INCLUDE_DIRS}
+  ${Qt5Designer_INCLUDE_DIRS}
   ${CMAKE_CURRENT_BINARY_DIR}
   ${CMAKE_CURRENT_SOURCE_DIR}
 )
@@ -206,7 +210,8 @@ endforeach(tool)
 #=========================================================
 #Add Foundation Libraries (this should be after our libraries, since we depend
 #on them)
-set(foundationLibraries clitkCommon ${ITK_LIBRARIES} QVTK vtkHybrid)
+#set(foundationLibraries clitkCommon ${ITK_LIBRARIES} QVTK vtkHybrid)
+set(foundationLibraries clitkCommon ${ITK_LIBRARIES} ${VTK_LIBRARIES})
 
 #=========================================================
 # Use CxImage to create animated gifs
@@ -236,7 +241,8 @@ if(APPLE)
 endif()
 #=========================================================
 #Create binary and libs for tests
-set(vvExternalLibs clitkSegmentationGgoLib ${toolLibs} ${foundationLibraries} ${vvCxImage} ${QT_LIBRARIES} ${QT_QTNETWORK_LIBRARY} ${APPLE_FRAMEWORKS})
+#set(vvExternalLibs clitkSegmentationGgoLib ${toolLibs} ${foundationLibraries} ${vvCxImage} ${Qt5Widgets_LIBRARIES_DIRS} ${Qt5Network_LIBRARIES_DIRS} ${APPLE_FRAMEWORKS})
+set(vvExternalLibs clitkSegmentationGgoLib ${toolLibs} ${foundationLibraries} ${vvCxImage} Qt5::Widgets Qt5::Network Qt5::Designer ${APPLE_FRAMEWORKS})
 # QtNetwork is required by vvRegisterForm
 
 add_library(vvLib ${vv_SRCS} ${vv_UI_CXX})