From 90f41b2edb316edacfb11c3dfbc6ef7fc5e25dfc Mon Sep 17 00:00:00 2001
From: Thomas Feuvrier <thomas.feuvrier@c-s.fr>
Date: Wed, 26 Sep 2007 12:34:35 +0000
Subject: [PATCH] =?UTF-8?q?Correction=20sur=20Fichier=20:=20ajout=20de=20l?=
 =?UTF-8?q?'option=20qui=20permet=20de=20diff=C3=A9rencier=20une=20compila?=
 =?UTF-8?q?tion=20des=20exemples=20-=20dans=20l'arborescence=20ou=20-=20en?=
 =?UTF-8?q?=20dehors=20de=20l'arborescence=20de=20l'OTB.?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 Examples/CMakeLists.txt | 102 ++++++++++++++++++++++++++++++++--------
 1 file changed, 82 insertions(+), 20 deletions(-)

diff --git a/Examples/CMakeLists.txt b/Examples/CMakeLists.txt
index 2830d40926..fb55748fd0 100644
--- a/Examples/CMakeLists.txt
+++ b/Examples/CMakeLists.txt
@@ -1,27 +1,89 @@
-PROJECT(HelloWorld)
+# $Id$
 
-FIND_PACKAGE(OTB)
-IF(OTB_FOUND)
-  INCLUDE(${OTB_USE_FILE})
-ELSE(OTB_FOUND)
-  MESSAGE(FATAL_ERROR
-      "Cannot build OTB project without OTB.  Please set OTB_DIR.")
-ENDIF(OTB_FOUND)
+PROJECT(OTBExamples)
 
-ADD_EXECUTABLE(HelloWorldOTB HelloWorldOTB.cxx )
-TARGET_LINK_LIBRARIES(HelloWorldOTB OTBCommon OTBIO)
+IF(OTB_BINARY_DIR)
+  # We are building inside the tree.
 
-ADD_EXECUTABLE(Pipeline Pipeline.cxx )
-TARGET_LINK_LIBRARIES(Pipeline OTBCommon OTBIO)
+SUBDIRS( 
+  BasicFilters
+  FeatureExtraction
+  DataRepresentation
+  IO
+  Filtering
+  ChangeDetection
+  Learning
+  Classification
+  Segmentation
+  Iterators
+  MultiScale
+  DisparityMap
+  Registration
+  Tutorials
+)
 
-ADD_EXECUTABLE(FilteringPipeline FilteringPipeline.cxx )
-TARGET_LINK_LIBRARIES(FilteringPipeline OTBCommon OTBIO)
+IF(OTB_USE_VISU)
+        SUBDIRS(Visu)
+ENDIF(OTB_USE_VISU)
 
-ADD_EXECUTABLE(ScalingPipeline ScalingPipeline.cxx )
-TARGET_LINK_LIBRARIES(ScalingPipeline OTBCommon OTBIO)
+IF(OTB_USE_PATENTED)
+  SUBDIRS( Patented )
+ENDIF(OTB_USE_PATENTED)
 
-ADD_EXECUTABLE(SmarterFilteringPipeline SmarterFilteringPipeline.cxx )
-TARGET_LINK_LIBRARIES(SmarterFilteringPipeline OTBCommon OTBIO)
+#Recopie du fichier README.txt dans l'arborescence BINARY
+IF( EXISTS ${OTB_BINARY_DIR}/Examples/README.txt )
+ELSE( EXISTS ${OTB_BINARY_DIR}/Examples/README.txt )
+  CONFIGURE_FILE(${OTB_SOURCE_DIR}/Examples/README.txt
+    ${OTB_BINARY_DIR}/Examples/README.txt @ONLY IMMEDIATE)
+ENDIF( EXISTS ${OTB_BINARY_DIR}/Examples/README.txt )
+
+
+ELSE(OTB_BINARY_DIR)
+  # We are building as a stand-alone project.
+  SET(LIBRARY_OUTPUT_PATH ${OTBExamples_BINARY_DIR}/bin CACHE PATH "Single output directory for building all libraries.")
+  SET(EXECUTABLE_OUTPUT_PATH ${OTBExamples_BINARY_DIR}/bin CACHE PATH "Single output directory for building all executables.")
+  MARK_AS_ADVANCED(LIBRARY_OUTPUT_PATH EXECUTABLE_OUTPUT_PATH)
+  SET(CXX_TEST_PATH ${EXECUTABLE_OUTPUT_PATH})
+
+  # Configure Dart testing support.
+  SET(PROJECT_SOURCE_DIR "${OTBExamples_SOURCE_DIR}/..")
+  INCLUDE(${CMAKE_ROOT}/Modules/Dart.cmake)
+  SET(PROJECT_SOURCE_DIR "${OTBExamples_SOURCE_DIR}")
+  MARK_AS_ADVANCED(TCL_TCLSH)
+  IF(BUILD_TESTING)
+    ENABLE_TESTING()
+  ENDIF(BUILD_TESTING)
+
+  # Find OTB and load its settings.
+  FIND_PACKAGE(OTB)
+  IF(OTB_FOUND)
+    INCLUDE(${OTB_USE_FILE})
+    SUBDIRS( 
+        BasicFilters
+        FeatureExtraction
+        DataRepresentation
+        IO
+        Filtering
+        ChangeDetection
+        Learning
+        Classification
+        Segmentation
+        Iterators
+        MultiScale
+        DisparityMap
+        Registration
+        Tutorials
+        )
+
+    IF(OTB_USE_VISU)
+        SUBDIRS(Visu)
+    ENDIF(OTB_USE_VISU)
+
+    IF(OTB_USE_PATENTED)
+        SUBDIRS( Patented )
+    ENDIF(OTB_USE_PATENTED)
+  ELSE(OTB_FOUND)
+    MESSAGE("OTB not found.  Please set OTB_DIR")
+  ENDIF(OTB_FOUND)
+ENDIF(OTB_BINARY_DIR)
 
-ADD_EXECUTABLE(SimpleViewer SimpleViewer.cxx )
-TARGET_LINK_LIBRARIES(SimpleViewer OTBCommon OTBIO OTBGui OTBVisu)
\ No newline at end of file
-- 
GitLab