diff --git a/Examples/CMakeLists.txt b/Examples/CMakeLists.txt index 2830d4092675283cf0beb0506b2d1f22f321ff61..fb55748fd005fa0f431ab3b9da8356fdc6ea030d 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