diff --git a/Examples/CMakeLists.txt b/Examples/CMakeLists.txt index 6b8deb6e4a548534b1652c0bcb52d845918d30b8..04a7b799609ff8cb54fc71f855b71f653b217225 100644 --- a/Examples/CMakeLists.txt +++ b/Examples/CMakeLists.txt @@ -9,6 +9,7 @@ if(NOT PROJECT_NAME) endif() #check if this is a standalone build? + if(PROJECT_NAME STREQUAL "OTBExamples") if(BUILD_TESTING) include(CTest) @@ -80,27 +81,27 @@ if(PROJECT_NAME STREQUAL "OTBExamples") ########################## end copied from OTB/CMakeLists.txt ########################## - set(OTB_BUILD_DEFAULT_MODULES ON) + #must be updated for new modules! + set(REQUIRED_MODULES "OTB6S;OTBITK;OTBAnomalyDetection;OTBBoost;OTBCommon;OTBGDAL;OTBOpenThreads;OTBOssim;OTBGeoTIFF;OTBOssimPlugins;OTBOSSIMAdapters;OTBObjectList;OTBMetadata;OTBImageBase;OTBBoostAdapters;OTBGdalAdapters;OTBTinyXML;OTBVectorDataBase;OTBIOGDAL;OTBExtendedFilename;OTBIOBSQ;OTBIOLUM;OTBIOMSTAR;OTBIOMW;OTBIOONERA;OTBIORAD;OTBCurl;OTBCurlAdapters;OTBIOTileMap;OTBStreaming;OTBImageIO;OTBInterpolation;OTBTransform;OTBImageManipulation;OTBTestKernel;OTBPath;OTBVectorDataManipulation;OTBProjection;OTBlibkml;OTBIOKML;OTBVectorDataIO;OTBApplicationEngine;OTBStatistics;OTBChangeDetection;OTBAppChangeDetection;OTBCommandLine;OTBColorMap;OTBMoments;OTBLabelMap;OTBConversion;OTBFuzzy;OTBMuParser;OTBMathParser;OTBSupervised;OTBDempsterShafer;OTBIOXML;OTBIndices;OTBMajorityVoting;OTBSOM;OTBAppClassification;OTBPointSet;OTBSiftFast;OTBDescriptors;OTBAppDescriptors;OTBDimensionalityReduction;OTBAppDimensionalityReduction;OTBSpatialObjects;OTBEdge;OTBAppEdge;OTBImageNoise;OTBAppFiltering;OTBConvolution;OTBPanSharpening;OTBAppFusion;OTBEndmembersExtraction;OTBWavelet;OTBUnmixing;OTBAppHyperspectral;OTBCarto;OTBAppImageUtils;OTBAppIndices;OTBKMZWriter;OTBAppKMZ;OTBAppMathParser;OTBMuParserX;OTBMathParserX;OTBAppMathParserX;OTBAppMoments;OTBAppMorphology;OTBOpticalCalibration;OTBAppOpticalCalibration;OTBAppProjection;OTBSARCalibration;OTBAppSARCalibration;OTBCCOBIA;OTBSmoothing;OTBMeanShift;OTBMetrics;OTBMorphologicalProfiles;OTBLabelling;OTBOGRProcessing;OTBWatersheds;OTBAppSegmentation;OTBDEM;OTBStereo;OTBDisparityMap;OTBAppStereo;OTBAppTest;OTBTextures;OTBAppTextures;OTBAppVectorDataTranslation;OTBAppVectorUtils;OTBCommandLineParser;OTBOpenThreadsAdapters;OTBCloudDetection;OTBComplexImage;OTBCorner;OTBDensity;OTBDisplacementField;OTBLandSatClassifier;OTBLearningBase;OTBMarkov;OTBMorphologicalPyramid;OTBObjectDetection;OTBPolarimetry;OTBRoadExtraction;OTBRCC8;OTBSWIGWrapper;OTBSeamCarving;OTBSimulation;OTBTimeSeries;OTBUrbanArea") + + find_package(OTB REQUIRED COMPONENTS ${REQUIRED_MODULES}) + include(${OTB_USE_FILE}) + message(STATUS "Found OTB: ${OTB_USE_FILE}") + else() if(NOT OTB_BUILD_DEFAULT_MODULES) message(FATAL_ERROR "BUILD_EXAMPLES requires OTB_BUILD_DEFAULT_MODULES to be ON") endif() - + # We also need to prevent any OTB_USE_XXX option to be OFF (except mapnik and openjpeg) + # For now we parse module activation list and test if option is ON. If not the cmake configuration stop. + #TODO We should provide a better mechanism here wich will deactivate only examples required by deactivated options. + foreach (_activationOption ${OTB_MODULE_ACTIVATION_OPTION_LIST}) + if(NOT ${_activationOption} AND NOT "x${_activationOption}" STREQUAL "xOTB_USE_MAPNIK" AND NOT "x${_activationOption}" STREQUAL "xOTB_USE_OPENJPEG") + message(FATAL_ERROR "BUILD_EXAMPLES requires ${_activationOption} to be ON") + endif() + endforeach() endif() -# We also need to prevent any OTB_USE_XXX option to be OFF (except mapnik and openjpeg) -# For now we parse module activation list and test if option is ON. If not the cmake configuration stop. -#TODO We should provide a better mechanism here wich will deactivate only examples required by deactivated options. -foreach (_activationOption ${OTB_MODULE_ACTIVATION_OPTION_LIST}) - if(NOT ${_activationOption} AND NOT "x${_activationOption}" STREQUAL "xOTB_USE_MAPNIK" AND NOT "x${_activationOption}" STREQUAL "xOTB_USE_OPENJPEG") - message(FATAL_ERROR "BUILD_EXAMPLES requires ${_activationOption} to be ON") - endif() -endforeach() - -find_package(OTB REQUIRED) -include(${OTB_USE_FILE}) - -message(STATUS "Found OTB: ${OTB_USE_FILE}") set(OTB_TEST_DRIVER otbTestDriver) if(OTBApplicationEngine_LOADED)