-CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
+## =========================================================================
+## @author Leonardo Florez-Valencia (florez-l@javeriana.edu.co)
+## =========================================================================
-# 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
- )
+## == Base project configuration
+cmake_minimum_required(VERSION 3.0)
+set(prj_NAME cpPlugins)
+set(prj_MAJ 1)
+set(prj_MIN 0)
+set(prj_REL 0)
-## ================
-## = Project name =
-## ================
+## == Project definiton
+project(${prj_NAME} VERSION "${prj_MAJ}.${prj_MIN}.${prj_REL}")
+include(cmake/cpPlgDefinitions.cmake)
+include(cmake/cpPlgFunctions.cmake)
-PROJECT(cpPlugins)
-SET(prj_MAJOR_VERSION "0")
-SET(prj_MINOR_VERSION "0")
-SET(prj_RELEASE_VERSION "1")
-SET(
- prj_VERSION
- "${prj_MAJOR_VERSION}.${prj_MINOR_VERSION}.${prj_RELEASE_VERSION}"
- )
+## == User could want only cmake scripts
+option(cpPlugins_BUILD "Build targets?" OFF)
+if(cpPlugins_BUILD)
-## ===========
-## = Options =
-## ===========
+ ## == Options
+ option(BUILD_PLUGINS_cpPluginsBase "Build base plugins?" OFF)
-OPTION(USE_QT4 "Build Qt4-based code" OFF)
-OPTION(BUILD_EXAMPLES "Build examples" OFF)
+ ## == Find Boost
+ find_package(Boost REQUIRED COMPONENTS filesystem program_options)
-## ========================
-## = Packages and options =
-## ========================
+ ## == Find Qt5
+ find_package(Qt5 CONFIG REQUIRED COMPONENTS Widgets)
+ set(CMAKE_INCLUDE_CURRENT_DIR ON)
+ set(CMAKE_AUTOMOC ON)
-INCLUDE(GenerateExportHeader)
+ ## == Process subdirs
+ subdirs(appli lib)
-## -------------------------------------------------------------------------
-## If compiling on UNIX-like OS, an error could arise when using ITKVtkGlue:
-##
-## <command-line>:0:0: warning: "vtkRenderingCore_AUTOINIT" redefined
-## <command-line>:0:0: note: this is the location of the previous definition
-##
-## This is avoided by not including the VTK_USE_FILE. Nevertheless, this fails
-## on MS-Win OS.
-##
-## This is due to object factories. To avoid this, and let the project be
-## usable on UNIX-like and MS-Win, the way to find ITK and VTK differs
-## -------------------------------------------------------------------------
+endif(cpPlugins_BUILD)
+include(cmake/cpPlgInstallCommands.cmake)
-IF(UNIX)
- FIND_PACKAGE(ITK REQUIRED)
- FIND_PACKAGE(VTK REQUIRED)
- INCLUDE(${ITK_USE_FILE})
- IF(NOT ITKVtkGlue_LOADED)
- MESSAGE(FATAL_ERROR "ITKVtkGlue module is required but not available.")
- ENDIF(NOT ITKVtkGlue_LOADED)
-ELSE(UNIX)
- FIND_PACKAGE(ITK REQUIRED)
- INCLUDE(${ITK_USE_FILE})
- IF(ITKVtkGlue_LOADED)
- FIND_PACKAGE(VTK REQUIRED)
- INCLUDE(${VTK_USE_FILE})
- ELSE(ITKVtkGlue_LOADED)
- FIND_PACKAGE(ItkVtkGlue REQUIRED)
- INCLUDE(${ItkVtkGlue_USE_FILE})
- SET(Glue ItkVtkGlue)
- ENDIF(ITKVtkGlue_LOADED)
-ENDIF(UNIX)
-
-IF(USE_QT4)
- FIND_PACKAGE(Qt4 REQUIRED)
- INCLUDE(${QT_USE_FILE})
-
- ## Check for required modules
- IF(NOT vtkGUISupportQt_LOADED)
- MESSAGE(
- FATAL_ERROR
- "vtkGUISupportQt module is required but not available."
- )
- ENDIF(NOT vtkGUISupportQt_LOADED)
- IF(NOT vtkGUISupportQtOpenGL_LOADED)
- MESSAGE(
- FATAL_ERROR
- "vtkGUISupportQtOpenGL module is required but not available."
- )
- ENDIF(NOT vtkGUISupportQtOpenGL_LOADED)
-ENDIF(USE_QT4)
-
-## ================================================
-## = Do not allow to build inside the source tree =
-## ================================================
-
-IF(PROJECT_BINARY_DIR STREQUAL ${PROJECT_SOURCE_DIR})
- MESSAGE(FATAL_ERROR "Building in the source tree is not allowed")
-ENDIF(PROJECT_BINARY_DIR STREQUAL ${PROJECT_SOURCE_DIR})
-
-## =====================================
-## = Where to put executables and libs =
-## =====================================
-
-SET(EXECUTABLE_OUTPUT_PATH ${PROJECT_BINARY_DIR})
-SET(LIBRARY_OUTPUT_PATH ${PROJECT_BINARY_DIR})
-MARK_AS_ADVANCED(
- CMAKE_BACKWARDS_COMPATIBILITY
- EXECUTABLE_OUTPUT_PATH
- LIBRARY_OUTPUT_PATH
- )
-
-## ==============================
-## = Subdirs containing headers =
-## ==============================
-
-INCLUDE_DIRECTORIES(
- ${PROJECT_SOURCE_DIR}/lib
- ${PROJECT_SOURCE_DIR}/lib/third_party
- ${PROJECT_BINARY_DIR}/lib
- ${PROJECT_BINARY_DIR}/lib/third_party
- )
-IF(WIN32)
- INCLUDE_DIRECTORIES(
- ${PROJECT_SOURCE_DIR}/lib/third_party/glext
- )
-ENDIF(WIN32)
-
-## ===========================
-## = Subdirs containing code =
-## ===========================
-
-SUBDIRS(
- cmake
- lib
- appli
- )
+## == Prepare CMake scripts
+subdirs(cmake)
## eof - $RCSfile$