]> Creatis software - cpPlugins.git/blobdiff - lib/CMakeLists.txt
...
[cpPlugins.git] / lib / CMakeLists.txt
index bf5213eaed81aa4501e01df94f8bdbee9f43b951..30d104ade02c08647cfab715461dc4ae839822a5 100644 (file)
@@ -1,51 +1,75 @@
 
-## =========================
-## == Auxiliary libraries ==
-## =========================
+## ======================
+## == Helper libraries ==
+## ======================
 
-CompileLibFromDir(cp_tinyxml2 SHARED tinyxml2)
-CompileLibFromDir(cpExtensions SHARED cpExtensions)
+SET(
+  _cpExtensions_components
+  cpExtensions/Config.h.in
+  cpExtensions/DataStructures
+  cpExtensions/Algorithms
+  cpExtensions/Interaction
+  cpExtensions/Visualization
+  )
+
+IF(BUILD_QT4_COMPONENTS)
+  LIST(APPEND _cpExtensions_components "cpExtensions/QT")
+ENDIF(BUILD_QT4_COMPONENTS)
+cpPlugins_BuildLibrary(cpExtensions SHARED ${_cpExtensions_components})
 TARGET_LINK_LIBRARIES(
-  cpExtensions ${QT_LIBRARIES} ${ITK_LIBRARIES} ${VTK_LIBRARIES}
+  cpExtensions
+  ${QT_LIBRARIES} ${ITK_LIBRARIES} ${VTK_LIBRARIES}
+  )
+
+## ============================================
+## == Explicit instances from templated code ==
+## ============================================
+
+SUBDIRS(
+  cpInstances
   )
-IF(USE_QT4)
-  CompileLibFromDir(cp_QCustomPlot SHARED QCustomPlot)
-  TARGET_LINK_LIBRARIES(cp_QCustomPlot ${QT_LIBRARIES})
-ENDIF(USE_QT4)
 
 ## ==================
-## == Main library ==
+## == Base library ==
 ## ==================
 
+SET(_real_config ${CMAKE_CURRENT_BINARY_DIR}/cpPlugins/RealConfig.h)
 ADD_CUSTOM_COMMAND(
-  OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/cpPlugins/RealConfig.h
+  OUTPUT ${_real_config}
   COMMAND ${CMAKE_COMMAND} -E make_directory ${CMAKE_CURRENT_BINARY_DIR}/cpPlugins
-  COMMAND ${cpPlugins_bash_CreateRealConfig_APP} ${CMAKE_CURRENT_BINARY_DIR}/cpPlugins/RealConfig.h
+  COMMAND ${cpPlugins_bash_CreateRealConfig_APP} ${_real_config}
   DEPENDS ${cpPlugins_bash_CreateRealConfig_APP}
   )
-CompileLibFromDir(
-  cpPlugins SHARED
-  ${CMAKE_CURRENT_SOURCE_DIR}/cpPlugins
-  ${CMAKE_CURRENT_BINARY_DIR}/cpPlugins/RealConfig.h
-  )
-TARGET_LINK_LIBRARIES(
-  cpPlugins
-  cp_tinyxml2
-  ${QT_LIBRARIES} ${ITK_LIBRARIES} ${VTK_LIBRARIES}
+SET(
+  _cpPlugins_components
+  ${_real_config}
+  cpPlugins/Config.h.in
+  cpPlugins/tinyxml2
+  cpPlugins/OS
+  cpPlugins/Pipeline
+  cpPlugins/Interface
   )
+IF(BUILD_QT4_COMPONENTS)
+  LIST(APPEND _cpPlugins_components "cpPlugins/QT")
+ENDIF(BUILD_QT4_COMPONENTS)
+cpPlugins_BuildLibrary(cpPlugins SHARED ${_cpPlugins_components})
+TARGET_LINK_LIBRARIES(cpPlugins ${ITK_LIBRARIES} ${VTK_LIBRARIES})
+IF(BUILD_QT4_COMPONENTS)
+  TARGET_LINK_LIBRARIES(cpPlugins ${QT_LIBRARIES})
+ENDIF(BUILD_QT4_COMPONENTS)
 
-## =====================
-## == Other libraries ==
-## =====================
-
-SUBDIRS(cpInstances)
+## ===================================
+## == Base library for applications ==
+## ===================================
 
-IF(USE_QT4)
-  CompileLibFromDir(cpBaseQtApplication SHARED cpBaseQtApplication)
+IF(BUILD_QT4_COMPONENTS)
+  cpPlugins_BuildLibrary(cpBaseQtApplication SHARED cpBaseQtApplication)
+  cpPlugins_BuildLibrary(cp_QCustomPlot SHARED QCustomPlot)
   TARGET_LINK_LIBRARIES(
     cpBaseQtApplication
-    ${QT_LIBRARIES} cpExtensions cpPlugins
+    cpExtensions cpPlugins
     )
-ENDIF(USE_QT4)
+  TARGET_LINK_LIBRARIES(cp_QCustomPlot ${QT_LIBRARIES})
+ENDIF(BUILD_QT4_COMPONENTS)
 
 ## eof - $RCSfile$