From 9c5a6e7ee0183d2d7bed17c598feda9e2f41b23c Mon Sep 17 00:00:00 2001
From: Victor Poughon <victor.poughon@cnes.fr>
Date: Fri, 14 Dec 2018 11:00:43 +0100
Subject: [PATCH] REFAC: remove OTB_USE_DEPRECATED

---
 CMake/OTBModuleEnablement.cmake               |  2 --
 CMakeLists.txt                                |  5 ----
 Examples/IO/CMakeLists.txt                    |  6 ++---
 Examples/IO/test/CMakeLists.txt               | 26 +++++++++----------
 Modules/IO/ImageIO/src/otbImageIOFactory.cxx  |  4 ---
 Modules/IO/ImageIO/test/CMakeLists.txt        | 14 ++++------
 .../IO/ImageIO/test/otbImageIOTestDriver.cxx  |  2 --
 SuperBuild/CMake/External_otb.cmake           |  1 +
 8 files changed, 20 insertions(+), 40 deletions(-)

diff --git a/CMake/OTBModuleEnablement.cmake b/CMake/OTBModuleEnablement.cmake
index 453b8213d0..4ec34d94df 100644
--- a/CMake/OTBModuleEnablement.cmake
+++ b/CMake/OTBModuleEnablement.cmake
@@ -196,8 +196,6 @@ foreach(otb-module ${OTB_MODULES_ALL})
   if(OTB_MODULE_${otb-module}_ACTIVATION_OPTION
      AND NOT ${OTB_MODULE_${otb-module}_ACTIVATION_OPTION})
      otb_module_disable("${otb-module}" "${OTB_MODULE_${otb-module}_ACTIVATION_OPTION}")
-  elseif(OTB_MODULE_${otb-module}_IS_DEPRECATED AND NOT OTB_USE_DEPRECATED)
-     otb_module_disable("${otb-module}" "OTB_USE_DEPRECATED")
   endif()
 endforeach()
 
diff --git a/CMakeLists.txt b/CMakeLists.txt
index e8d6abc448..7cb4d0d072 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -219,11 +219,6 @@ else()
   set(OTB_CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS OFF)
 endif()
 
-#-----------------------------------------------------------------------------
-# Option to activate deprecated classes
-option(OTB_USE_DEPRECATED "Turn on the use and test of deprecated classes" OFF)
-mark_as_advanced(OTB_USE_DEPRECATED)
-
 # Although the OpenMP option looks like a 3rd party module, it is NOT. This option
 # is handled with other compilation flags in file OTBSetStandardCompilerFlags.cmake
 # before any module is parsed or enabled (see OTBModuleEnablement.cmake later on
diff --git a/Examples/IO/CMakeLists.txt b/Examples/IO/CMakeLists.txt
index f3aab131cb..90ad881b74 100644
--- a/Examples/IO/CMakeLists.txt
+++ b/Examples/IO/CMakeLists.txt
@@ -73,10 +73,8 @@ target_link_libraries(StreamingImageReadWrite ${OTB_LIBRARIES})
 add_executable(VectorDataIOExample VectorDataIOExample.cxx)
 target_link_libraries(VectorDataIOExample ${OTB_LIBRARIES})
 
-if(OTB_USE_DEPRECATED)
-  add_executable(TileMapImageIOExample TileMapImageIOExample.cxx)
-  target_link_libraries(TileMapImageIOExample ${OTB_LIBRARIES})
-endif()
+add_executable(TileMapImageIOExample TileMapImageIOExample.cxx)
+target_link_libraries(TileMapImageIOExample ${OTB_LIBRARIES})
 
 if(BUILD_TESTING)
   add_subdirectory(test)
diff --git a/Examples/IO/test/CMakeLists.txt b/Examples/IO/test/CMakeLists.txt
index 9a410111a5..458530955d 100644
--- a/Examples/IO/test/CMakeLists.txt
+++ b/Examples/IO/test/CMakeLists.txt
@@ -101,17 +101,15 @@ otb_add_test(NAME ioTeImageToKmzAndMapFileProductExample COMMAND ${OTB_TEST_DRIV
 set_property(TEST ioTeImageToKmzAndMapFileProductExample PROPERTY RESOURCE_LOCK web_access)
 endif()
 
-if(OTB_USE_DEPRECATED)
-    otb_add_test(NAME ioTeTileMapImageIOExampleTest COMMAND ${OTB_TEST_DRIVER}
-  --compare-image 10.0
-    ${BASELINE}/openStreetMap.png
-    ${TEMP}/openStreetMap.png
-  Execute $<TARGET_FILE:TileMapImageIOExample>
-    ${INPUTDATA}/osmfile.otb
-    ${TEMP}/openStreetMap.png
-    ${TEMP}
-    1.4835345
-    43.55968261
-    12
-    )
-endif()
+otb_add_test(NAME ioTeTileMapImageIOExampleTest COMMAND ${OTB_TEST_DRIVER}
+--compare-image 10.0
+  ${BASELINE}/openStreetMap.png
+  ${TEMP}/openStreetMap.png
+Execute $<TARGET_FILE:TileMapImageIOExample>
+  ${INPUTDATA}/osmfile.otb
+  ${TEMP}/openStreetMap.png
+  ${TEMP}
+  1.4835345
+  43.55968261
+  12
+  )
diff --git a/Modules/IO/ImageIO/src/otbImageIOFactory.cxx b/Modules/IO/ImageIO/src/otbImageIOFactory.cxx
index 664fd51b85..be454bf577 100644
--- a/Modules/IO/ImageIO/src/otbImageIOFactory.cxx
+++ b/Modules/IO/ImageIO/src/otbImageIOFactory.cxx
@@ -33,9 +33,7 @@
 #include "otbBSQImageIOFactory.h"
 #include "otbRADImageIOFactory.h"
 
-#if OTB_USE_DEPRECATED
 #include "otbTileMapImageIOFactory.h"
-#endif
 
 namespace otb
 {
@@ -100,9 +98,7 @@ ImageIOFactory::RegisterBuiltInFactories()
       itk::ObjectFactoryBase::RegisterFactory(GDALImageIOFactory::New());
       itk::ObjectFactoryBase::RegisterFactory(ONERAImageIOFactory::New());
       itk::ObjectFactoryBase::RegisterFactory(MSTARImageIOFactory::New());
-#if OTB_USE_DEPRECATED
       itk::ObjectFactoryBase::RegisterFactory(TileMapImageIOFactory::New());
-#endif
       firstTime = false;
       }
     }
diff --git a/Modules/IO/ImageIO/test/CMakeLists.txt b/Modules/IO/ImageIO/test/CMakeLists.txt
index d9c01a09d8..6a1a09f58b 100644
--- a/Modules/IO/ImageIO/test/CMakeLists.txt
+++ b/Modules/IO/ImageIO/test/CMakeLists.txt
@@ -77,9 +77,7 @@ otbMultiImageFileWriterTest.cxx
 otbWriteGeomFile.cxx
 )
 
-if(OTB_USE_DEPRECATED)
-  set(OTBImageIOTests ${OTBImageIOTests} otbImageFileReaderServerName.cxx)
-endif()
+set(OTBImageIOTests ${OTBImageIOTests} otbImageFileReaderServerName.cxx)
 
 add_executable(otbImageIOTestDriver ${OTBImageIOTests})
 target_link_libraries(otbImageIOTestDriver ${OTBImageIO-Test_LIBRARIES})
@@ -522,12 +520,10 @@ otb_add_test(NAME ioTvONERAImageFileWriterComplex COMMAND otbImageIOTestDriver
   LARGEINPUT{ONERA/spa3_0215_rad.ent}
   ${TEMP}/ioImageFileReaderONERAComplexWrite.ent )
 
-if(OTB_USE_DEPRECATED)
-  otb_add_test(NAME ioTvImageFileReaderServerNameOTBTest COMMAND otbImageIOTestDriver
-    otbImageFileReaderServerName
-    ${OTB_DATA_ROOT}/Examples/osmfile.otb)
-  set_property(TEST ioTvImageFileReaderServerNameOTBTest PROPERTY RESOURCE_LOCK web_access)
-endif()
+otb_add_test(NAME ioTvImageFileReaderServerNameOTBTest COMMAND otbImageIOTestDriver
+  otbImageFileReaderServerName
+  ${OTB_DATA_ROOT}/Examples/osmfile.otb)
+set_property(TEST ioTvImageFileReaderServerNameOTBTest PROPERTY RESOURCE_LOCK web_access)
 
 #dashboard_hell
 # otb_add_test(NAME ioTvImageFileReaderServerNameHTTPTest COMMAND otbImageIOTestDriver
diff --git a/Modules/IO/ImageIO/test/otbImageIOTestDriver.cxx b/Modules/IO/ImageIO/test/otbImageIOTestDriver.cxx
index d92b29cfd4..4915a8e535 100644
--- a/Modules/IO/ImageIO/test/otbImageIOTestDriver.cxx
+++ b/Modules/IO/ImageIO/test/otbImageIOTestDriver.cxx
@@ -152,7 +152,5 @@ void RegisterTests()
   REGISTER_TEST(otbImageFileWriterOptBandTest);
   REGISTER_TEST(otbMultiImageFileWriterTest);
   REGISTER_TEST(otbWriteGeomFile);
-#if OTB_USE_DEPRECATED
   REGISTER_TEST(otbImageFileReaderServerName);
-#endif
 }
diff --git a/SuperBuild/CMake/External_otb.cmake b/SuperBuild/CMake/External_otb.cmake
index 987f301a16..d70aa19f25 100644
--- a/SuperBuild/CMake/External_otb.cmake
+++ b/SuperBuild/CMake/External_otb.cmake
@@ -222,6 +222,7 @@ ExternalProject_Add(OTB
   CMAKE_ARGS ${OTB_SB_CONFIG}
   CMAKE_COMMAND ${SB_CMAKE_COMMAND}
   LOG_CONFIGURE 1
+  CMAKE_GENERATOR Ninja
   )
 
 
-- 
GitLab