]> Creatis software - cpMesh.git/blobdiff - CMakeLists.txt
...
[cpMesh.git] / CMakeLists.txt
index 1776d43bd59730c90d76b6adf7be006d8f0e5ff7..231d94c2dc2ef02625034a8933bcde43fba442d9 100644 (file)
@@ -1,20 +1,20 @@
-CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
+CMAKE_MINIMUM_REQUIRED(VERSION 2.8)
 
-# for CMake 2.6 corrected behaviour (see "cmake --help-policy CMP0003")
-IF(
-    COMMAND cmake_policy AND
-    ${CMAKE_MAJOR_VERSION} EQUAL 2 AND
-    ${CMAKE_MINOR_VERSION} GREATER 4
-    )
-  CMAKE_POLICY(SET CMP0003 NEW)
-  CMAKE_POLICY(SET CMP0005 NEW)
-  CMAKE_POLICY(SET CMP0011 NEW)
-  CMAKE_POLICY(SET CMP0012 NEW)
-ENDIF(
-  COMMAND cmake_policy AND
-  ${CMAKE_MAJOR_VERSION} EQUAL 2 AND
-  ${CMAKE_MINOR_VERSION} GREATER 4
+## ============
+## = Policies =
+## ============
+
+SET(
+  policies
+  CMP0015
+  CMP0020
+  CMP0042
   )
+FOREACH(policy ${policies})
+  IF(POLICY ${policy})
+    CMAKE_POLICY(SET ${policy} NEW)
+  ENDIF(POLICY ${policy})
+ENDFOREACH(policy)
 
 ## ================
 ## = Project name =
@@ -39,21 +39,55 @@ ENDIF(BUILD_SHARED_LIBS)
 ## ============
 ## = Packages =
 ## ============
+
+# Prepare header to build shared libs (windows)
 INCLUDE(GenerateExportHeader)
 
+# Find ITK and VTK
 FIND_PACKAGE(ITK REQUIRED)
-INCLUDE(${ITK_USE_FILE})
-
 FIND_PACKAGE(VTK REQUIRED)
+
+INCLUDE(${ITK_USE_FILE})
 INCLUDE(${VTK_USE_FILE})
 
+# Do not use itk-vtk glue --> problems ahead!!!
+IF(ITKVtkGlue_LOADED)
+  MESSAGE(FATAL_ERROR "ITKVtkGlue module is available. Please re-compile your ITK without it. It could lead to nasty compilation problems... Just waiting for Kitware to solve it.")
+ENDIF(ITKVtkGlue_LOADED)
+
+SET(QT4_FOUND "0")
 IF(BUILD_FINAL_APPLICATION)
   FIND_PACKAGE(Qt4 REQUIRED)
   INCLUDE(${QT_USE_FILE})
 
-  FIND_PACKAGE(cpPlugins REQUIRED)
+  ## Check for required vtk-qt4 modules
+  SET(
+    vtk_required_modules
+    vtkGUISupportQt
+    vtkGUISupportQtOpenGL
+    )
+  FOREACH(vtk_module ${vtk_required_modules})
+    IF(NOT ${vtk_module}_LOADED)
+      MESSAGE(
+        FATAL_ERROR
+        "${vtk_module} module is required but not available."
+        )
+      SET(QT4_FOUND "0")
+    ENDIF(NOT ${vtk_module}_LOADED)
+  ENDFOREACH(vtk_module)
+  SET(QT4_FOUND "1")
 ENDIF(BUILD_FINAL_APPLICATION)
 
+OPTION(USE_cpPlugins "Build cpPlugins based stuff" OFF)
+IF(USE_cpPlugins)
+  FIND_PACKAGE(cpPlugins REQUIRED)
+ENDIF(USE_cpPlugins)
+
+OPTION(USE_FrontAlgorithms "Build FrontAlgorithms based stuff" OFF)
+IF(USE_FrontAlgorithms)
+  FIND_PACKAGE(FrontAlgorithms REQUIRED)
+ENDIF(USE_FrontAlgorithms)
+
 ## ================================================
 ## = Do not allow to build inside the source tree =
 ## ================================================