]> Creatis software - cpPlugins.git/commitdiff
...
authorLeonardo Flórez-Valencia <florez-l@javeriana.edu.co>
Tue, 3 Oct 2017 21:04:11 +0000 (16:04 -0500)
committerLeonardo Flórez-Valencia <florez-l@javeriana.edu.co>
Tue, 3 Oct 2017 21:04:11 +0000 (16:04 -0500)
CMakeLists.txt
cmake/CMakeLists.txt [new file with mode: 0644]
cmake/cpPlgDefinitions.cmake [moved from cmake/Definitions.cmake with 100% similarity]
cmake/cpPlgFunctions.cmake [moved from cmake/Functions.cmake with 100% similarity]
cmake/cpPlgInstallCommands.cmake [moved from cmake/InstallCommands.cmake with 83% similarity]
cmake/cpPluginsConfig.cmake.in

index 819a52ffbdecbc87172800d03b49ee14162eba1a..9c1193760dacd0be14cf5a7fd5068726bef9e165 100644 (file)
@@ -22,36 +22,42 @@ foreach(_p ${_policies})
 endforeach(_p)
 
 ## == Some general configuration
-include(cmake/Definitions.cmake)
-include(cmake/Functions.cmake)
-
-## == 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)
-
-## == Installation commands
-include(cmake/InstallCommands.cmake)
+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)
+
+## == CMake scripts
+subdirs(cmake)
 
 ## eof - $RCSfile$
diff --git a/cmake/CMakeLists.txt b/cmake/CMakeLists.txt
new file mode 100644 (file)
index 0000000..bb36430
--- /dev/null
@@ -0,0 +1,12 @@
+## =========================================================================
+## @author Leonardo Florez-Valencia (florez-l@javeriana.edu.co)
+## =========================================================================
+
+include(cpPlgInstallCommands.cmake)
+
+#INSTALL: cpPlgDefinitions.cmake
+#INSTALL: cpPlgFunctions.cmake
+#INSTALL: cpPlgInstallCommands.cmake
+
+## eof - $RCSfile$
+
similarity index 83%
rename from cmake/InstallCommands.cmake
rename to cmake/cpPlgInstallCommands.cmake
index 97500ae04fcf3055668bff87917dd22dbb8da5f8..cbfc91c1707b12f62cd52798219365ac872f9989 100644 (file)
@@ -23,15 +23,17 @@ write_basic_package_version_file(
   "${version_config}" COMPATIBILITY SameMajorVersion
   )
 configure_package_config_file(
-  "cmake/${PROJECT_NAME}Config.cmake.in"
+  "${PROJECT_NAME}Config.cmake.in"
   "${project_config}"
   INSTALL_DESTINATION "${config_install_dir}"
   )
-install(
-  EXPORT "${targets_export_name}"
-  NAMESPACE "${namespace}"
-  DESTINATION "${config_install_dir}"
-  )
+if(${PROJECT_NAME}_BUILD)
+  install(
+    EXPORT "${targets_export_name}"
+    NAMESPACE "${namespace}"
+    DESTINATION "${config_install_dir}"
+    )
+endif(${PROJECT_NAME}_BUILD)
 install(
   FILES "${project_config}"
   DESTINATION "${config_install_dir}"
index 891261c92f8731487ce09a09250173a5498cf300..58d75fad5fde626aa16f36a009b25dd3f21e63a1 100644 (file)
@@ -1,26 +1,38 @@
+## == Some general configuration
+include(@CMAKE_INSTALL_PREFIX@/lib/cmake/@PROJECT_NAME@/cpPlgDefinitions.cmake)
+include(@CMAKE_INSTALL_PREFIX@/lib/cmake/@PROJECT_NAME@/cpPlgFunctions.cmake)
+
+## == Automatically generated commands
 @PACKAGE_INIT@
 
 include("${CMAKE_CURRENT_LIST_DIR}/@targets_export_name@.cmake")
 check_required_components("@PROJECT_NAME@")
 
-## ===========================================
-## == Find needed packages and dependencies ==
-## ===========================================
-
-set(ITK_DIR "@ITK_DIR@")
-set(VTK_DIR "@VTK_DIR@")
-set(Qt5_DIR "@Qt5_DIR@")
+## ======================================
+## == Needed packages and dependencies ==
+## ======================================
 
+## == Find ITK
 find_package(ITK CONFIG REQUIRED)
 include(${ITK_USE_FILE})
-if(NOT "${VTK_DIR}" STREQUAL "")
+
+## == Find VTK, only if linked against ITK
+set(cpPlugins_USE_VTK 0)
+if(ITKVtkGlue_LOADED)
   find_package(VTK CONFIG REQUIRED)
   include(${VTK_USE_FILE})
-endif(NOT "${VTK_DIR}" STREQUAL "")
-if(NOT "${Qt5_DIR}" STREQUAL "")
-  find_package(Qt5 CONFIG REQUIRED COMPONENTS Widgets)
-  set(CMAKE_INCLUDE_CURRENT_DIR ON)
-  set(CMAKE_AUTOMOC ON)
-endif(NOT "${Qt5_DIR}" STREQUAL "")
+  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)
 
 ## eof - $RCSfile$