]> Creatis software - cpPlugins.git/blobdiff - CMakeLists.txt
...
[cpPlugins.git] / CMakeLists.txt
index d584f6e8ba961be5af0d887443142a28eba79432..c601431734d9dcd5f90eebe0d9c80727dab7e45b 100644 (file)
@@ -1,50 +1,66 @@
-CMAKE_MINIMUM_REQUIRED(VERSION 3.0)
-
-## ========================
-## == Project definition ==
-## ========================
-
-SET(prj_NAME cpPlugins)
-SET(prj_MAJ_VERSION 0)
-SET(prj_MIN_VERSION 1)
-SET(prj_REL_VERSION 0)
-SET(_subdirs cmake bash lib tools plugins appli)
-SET(_policies CMP0015 CMP0020 CMP0042)
-
-## ==========================
-## == Some useful policies ==
-## ==========================
-
-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_MAJ_VERSION}.${prj_MIN_VERSION}.${prj_REL_VERSION}")
-SET(prj_SHORT_VERSION "${prj_MAJ_VERSION}")
-
-## =====================================
-## == Functions, packages and options ==
-## =====================================
-
-INCLUDE(cmake/BaseConfig.cmake)
-INCLUDE(cmake/Options.cmake)
-INCLUDE(cmake/KitwareTools.cmake)
-INCLUDE(cmake/QtTools.cmake)
-INCLUDE(cmake/Functions.cmake)
-
-## ===========================
-## == Build different parts ==
-## ===========================
-
-FOREACH(_s ${_subdirs})
-  SUBDIRS(${_s})
-ENDFOREACH(_s)
+## =========================================================================
+## @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(_policies CMP0015 CMP0020 CMP0042 CMP0053)
+foreach(_p ${_policies})
+  if(POLICY ${_p})
+    cmake_policy(SET ${_p} NEW)
+  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$