]> Creatis software - clitk.git/blobdiff - cmake/build_opt.cmake
Ensure the compilation with Qt4 and Qt5
[clitk.git] / cmake / build_opt.cmake
index d7c60aa12268f5e0054119ea358ecb6feb856f5f..48ba5a67e01640afef43706b163cbff8b8aa3636 100644 (file)
@@ -1,36 +1,44 @@
 #=========================================================
 #Support for the CTest dashboard testing system
-OPTION(BUILD_TESTING "Build the testing tree" OFF)
-IF (BUILD_TESTING)
-  OPTION(CLITK_BUILD_TESTING "Test ITK" ON)
-  INCLUDE(CTest)
-ENDIF(BUILD_TESTING)
+option(BUILD_TESTING "Build the testing tree" OFF)
+if(BUILD_TESTING)
+  option(CLITK_BUILD_TESTING "Test ITK" ON)
+  include(CTest)
+endif(BUILD_TESTING)
 #=========================================================
 
 
 #=========================================================
 # If the user choose to build documentation, then search for Doxygen executables.
-OPTION(BUILD_DOXYGEN "Build Doxygen Documentation" OFF)
-IF(BUILD_DOXYGEN)
-  FIND_PACKAGE(Doxygen)
-  ADD_SUBDIRECTORY(${CLITK_SOURCE_DIR}/Doxygen ${PROJECT_BINARY_DIR}/Doxygen)
-ENDIF(BUILD_DOXYGEN)
+option(BUILD_DOXYGEN "Build Doxygen Documentation" OFF)
+if(BUILD_DOXYGEN)
+  find_package(Doxygen)
+  add_subdirectory(${CLITK_SOURCE_DIR}/Doxygen ${PROJECT_BINARY_DIR}/Doxygen)
+endif(BUILD_DOXYGEN)
 #=========================================================
 
 # Compilation options
-OPTION(CLITK_EXPERIMENTAL "Enable experimental software and features" OFF)
-OPTION(CLITK_BUILD_TOOLS "Build command-line tools" OFF)
-OPTION(CLITK_BUILD_SEGMENTATION "Build command-line segmentation tools" OFF)
-OPTION(CLITK_BUILD_REGISTRATION "Build command-line registration tools" OFF)
+option(CLITK_EXPERIMENTAL "Enable experimental software and features" OFF)
+option(CLITK_BUILD_TOOLS "Build command-line tools" OFF)
+option(CLITK_BUILD_SEGMENTATION "Build command-line segmentation tools" OFF)
+option(CLITK_BUILD_REGISTRATION "Build command-line registration tools" OFF)
 
-OPTION(CLITK_BUILD_VV "Build vv the 4D visualizer (requires VTK and QT)" ON)
-IF (CLITK_BUILD_VV)
-  ADD_SUBDIRECTORY(${CLITK_SOURCE_DIR}/vv ${PROJECT_BINARY_DIR}/vv)
-ENDIF(CLITK_BUILD_VV)
+option(CLITK_BUILD_VV "Build vv the 4D visualizer (requires VTK and QT)" ON)
+
+if(CLITK_BUILD_VV)
+    set(vv_QT_VERSION "4" CACHE STRING "Expected Qt version")
+    set_property(CACHE vv_QT_VERSION PROPERTY STRINGS 4 5)
+    if(NOT (vv_QT_VERSION VERSION_EQUAL "4" OR vv_QT_VERSION VERSION_EQUAL "5"))
+      message(FATAL_ERROR "Expected value for vv_QT_VERSION is either '4' or '5'")
+    endif()
+
+  add_subdirectory(${CLITK_SOURCE_DIR}/vv ${PROJECT_BINARY_DIR}/vv)
+endif(CLITK_BUILD_VV)
 
 #=========================================================
 # Build test when vv has been compiled
-IF(BUILD_TESTING)
-  ADD_SUBDIRECTORY(${CLITK_SOURCE_DIR}/tests ${PROJECT_BINARY_DIR}/tests)
-ENDIF(BUILD_TESTING)
+if(BUILD_TESTING)
+  add_subdirectory(${CLITK_SOURCE_DIR}/tests ${PROJECT_BINARY_DIR}/tests)
+endif(BUILD_TESTING)
+