]> Creatis software - cpPlugins.git/blobdiff - CMakeLists.txt
...
[cpPlugins.git] / CMakeLists.txt
index 2e161e434f4b0d3a23e46766c6fa9c864e507b4c..ea9d71a0d4a2c4a378dbfaa0e3455141d46850a0 100644 (file)
@@ -1,50 +1,73 @@
-CMAKE_MINIMUM_REQUIRED(VERSION 3.0)
-
-## ========================
-## == Project definition ==
-## ========================
-
-SET(prj_NAME cpPlugins)
-SET(prj_MAJOR_VERSION   0)
-SET(prj_MINOR_VERSION   1)
-SET(prj_RELEASE_VERSION 0)
-
-## ==========================
-## == Some useful policies ==
-## ==========================
-
-SET(_policies CMP0015 CMP0020 CMP0042)
-FOREACH(_p ${_policies})
-  IF(POLICY ${_p})
-    CMAKE_POLICY(SET ${_p} NEW)
-  ENDIF(POLICY ${_p})
-ENDFOREACH(_p)
-
-## ===========================
-## == Project configuration ==
-## ===========================
-
-PROJECT(${prj_NAME})
-SET(
-  prj_VERSION
-  "${prj_MAJOR_VERSION}.${prj_MINOR_VERSION}.${prj_RELEASE_VERSION}"
-  )
-SET(prj_SHORT_VERSION "${prj_MAJOR_VERSION}")
-
-## =====================================
-## == Functions, packages and options ==
-## =====================================
-
-INCLUDE(cmake/Restrictions.cmake)
-INCLUDE(cmake/Options.cmake)
-INCLUDE(cmake/KitwareTools.cmake)
-INCLUDE(cmake/QtTools.cmake)
-INCLUDE(cmake/Functions.cmake)
-
-## ===========================
-## == Build different parts ==
-## ===========================
-
-SUBDIRS(appli cmake lib plugins)
+## =========================================================================
+## @author Leonardo Florez-Valencia (florez-l@javeriana.edu.co)
+## =========================================================================
+
+cmake_minimum_required(VERSION 3.0)
+
+## == Basic project configuration
+set(prj_NAME cpPlugins)
+set(prj_MAJ 1)
+set(prj_MIN 0)
+set(prj_REL 0)
+
+## == Project definition
+project(${prj_NAME} VERSION "${prj_MAJ}.${prj_MIN}.${prj_REL}")
+
+## == Project policies
+set(_new_policies CMP0015 CMP0020 CMP0042 CMP0053)
+set(_old_policies CMP0006)
+foreach(_p ${_new_policies})
+  if(POLICY ${_p})
+    cmake_policy(SET ${_p} NEW)
+  endif(POLICY ${_p})
+endforeach(_p)
+foreach(_p ${_old_policies})
+  if(POLICY ${_p})
+    cmake_policy(SET ${_p} OLD)
+  endif(POLICY ${_p})
+endforeach(_p)
+
+## == Some general configuration
+include(cmake/cpPlgDefinitions.cmake)
+include(cmake/cpPlgFunctions.cmake)
+
+## == User could choose not to build
+option(cpPlugins_BUILD "Build targets." OFF)
+if(cpPlugins_BUILD)
+
+  ## == Find ITK
+  find_package(ITK CONFIG REQUIRED)
+  include(${ITK_USE_FILE})
+
+  ## == Find VTK, only if linked against ITK
+  set(cpPlugins_USE_VTK 0)
+  if(ITKVtkGlue_LOADED)
+    find_package(VTK CONFIG REQUIRED)
+    include(${VTK_USE_FILE})
+    set(cpPlugins_USE_VTK 1)
+  endif(ITKVtkGlue_LOADED)
+
+  ## == Find Qt5, only if linked against VTK
+  set(cpPlugins_USE_Qt5 0)
+  if(VTK_FOUND)
+    if(Qt5_DIR)
+      find_package(Qt5 CONFIG REQUIRED COMPONENTS Widgets)
+      set(CMAKE_INCLUDE_CURRENT_DIR ON)
+      set(CMAKE_AUTOMOC ON)
+      set(cpPlugins_USE_Qt5 1)
+    endif(Qt5_DIR)
+  endif(VTK_FOUND)
+
+  ## == Build packages
+  subdirs(appli lib)
+
+endif(cpPlugins_BUILD)
+
+## == Installation commands
+include(cmake/cpPlgInstallCommands.cmake)
+
+## == CMake scripts
+subdirs(cmake)
 
 ## eof - $RCSfile$
+