Blob Blame History Raw
From 06ad1df56f41b2cf4718307e9c2a15f929010925 Mon Sep 17 00:00:00 2001
From: "Ankur Sinha (Ankur Sinha Gmail)" <sanjay.ankur@gmail.com>
Date: Sun, 17 Feb 2019 19:53:12 +0000
Subject: [PATCH 3/7] Use add_subdirectories instead of deprecated subdirs

---
 Applications/CMakeLists.txt                   |  2 +-
 CMakeLists.txt                                | 16 ++++++-------
 Examples/CMakeLists.txt                       | 10 ++++----
 Source/CMakeLists.txt                         | 16 ++++++-------
 Testing/CMakeLists.txt                        |  4 +---
 Testing/Source/CMakeLists.txt                 | 16 ++++++-------
 Testing/Source/Common/CMakeLists.txt          |  4 ++--
 Testing/Source/DataDictionary/CMakeLists.txt  |  4 ++--
 .../CMakeLists.txt                            |  6 ++---
 .../CMakeLists.txt                            |  4 ++--
 .../MediaStorageAndFileFormat/CMakeLists.txt  |  6 ++---
 .../MessageExchangeDefinition/CMakeLists.txt  |  2 +-
 Utilities/CMakeLists.txt                      | 24 +++++++++----------
 Utilities/VTK/CMakeLists.txt                  |  6 ++---
 Utilities/VTK/Examples/CMakeLists.txt         |  8 +++----
 Utilities/VTK/Testing/CMakeLists.txt          |  6 ++---
 Utilities/doxygen/CMakeLists.txt              |  2 +-
 Utilities/gdcmexpat/CMakeLists.txt            |  2 +-
 Utilities/gdcmjpeg/CMakeLists.txt             |  4 +++-
 Wrapping/CMakeLists.txt                       | 10 ++++----
 20 files changed, 74 insertions(+), 78 deletions(-)

diff --git a/Applications/CMakeLists.txt b/Applications/CMakeLists.txt
index ccbaece9f..35f9732a9 100644
--- a/Applications/CMakeLists.txt
+++ b/Applications/CMakeLists.txt
@@ -1 +1 @@
-subdirs(Cxx)
+add_subdirectory(Cxx)
diff --git a/CMakeLists.txt b/CMakeLists.txt
index f82bfd251..86a4f6751 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -205,7 +205,7 @@ if(NOT GDCM_HAVE_STDINT_H)
       "${GDCM_SOURCE_DIR}/Utilities/C99"
       )
     # Process the install rules from C99
-    subdirs(Utilities/C99)
+    add_subdirectory(Utilities/C99)
   endif()
 endif()
 
@@ -602,11 +602,11 @@ if(GDCM_STANDALONE)
 else()
   set(BUILD_APPLICATIONS OFF)
 endif()
-subdirs(Utilities)
+add_subdirectory(Utilities)
 add_subdirectory(Source)
 
 if(GDCM_STANDALONE)
-  subdirs(Wrapping)
+  add_subdirectory(Wrapping)
   if(GDCM_WRAP_CSHARP)
     add_subdirectory(Wrapping/Csharp)
   endif()
@@ -615,7 +615,7 @@ endif()
 if(GDCM_STANDALONE)
   # After Wrapping please
   if(BUILD_EXAMPLES)
-    subdirs(Examples)
+    add_subdirectory(Examples)
   endif()
 endif()
 
@@ -655,7 +655,7 @@ if(GDCM_STANDALONE)
     mark_as_advanced(DART_TESTING_TIMEOUT)
     enable_testing()
     include(CTest)
-    subdirs(Testing)
+    add_subdirectory(Testing)
     if(NOT GDCM_DATA_ROOT)
       message("If you want to build the test suite, you must set GDCM_DATA_ROOT (advanced option) "
       "to the full path name of the gdcmData directory; if you don't want, disable GDCM_BUILD_TESTING.\n"
@@ -687,7 +687,7 @@ if(GDCM_STANDALONE)
     mark_as_advanced(VTK_DIR)
     set(GDCM_VTK_DIR ${VTK_DIR})
     mark_as_advanced(GDCM_USE_PARAVIEW)
-    subdirs(Utilities/VTK)
+    add_subdirectory(Utilities/VTK)
   endif()
 endif()
 
@@ -696,7 +696,7 @@ if(GDCM_STANDALONE)
   option(GDCM_BUILD_APPLICATIONS "apps ?" OFF)
   set(BUILD_APPLICATIONS ${GDCM_BUILD_APPLICATIONS})
   if(BUILD_APPLICATIONS)
-    subdirs(Applications)
+    add_subdirectory(Applications)
   endif()
 else()
   set(BUILD_APPLICATIONS OFF)
@@ -1051,5 +1051,5 @@ if(GDCM_USE_VTK)
 endif()
 set(GDCM_LIBRARY_DIRS ${LIBRARY_OUTPUT_PATH})
 if(GDCM_STANDALONE)
-subdirs(CMake/ExportConfiguration)
+add_subdirectory(CMake/ExportConfiguration)
 endif()
diff --git a/Examples/CMakeLists.txt b/Examples/CMakeLists.txt
index 8ac324abf..ca76e1bad 100644
--- a/Examples/CMakeLists.txt
+++ b/Examples/CMakeLists.txt
@@ -2,18 +2,18 @@ cmake_minimum_required(VERSION 2.8.7)
 
 # Choose behavior based on whether we are building inside the GDCM tree.
 if(GDCM_BINARY_DIR)
-subdirs(Cxx)
+add_subdirectory(Cxx)
 
 if(GDCM_WRAP_PYTHON)
-  subdirs(Python)
+  add_subdirectory(Python)
 endif()
 
 if(GDCM_WRAP_CSHARP)
-  subdirs(Csharp)
+  add_subdirectory(Csharp)
 endif()
 
 if(GDCM_WRAP_JAVA)
-  subdirs(Java)
+  add_subdirectory(Java)
 endif()
 
 else()
@@ -25,6 +25,6 @@ else()
   find_package(GDCM REQUIRED)
   include(${GDCM_USE_FILE})
 
-  subdirs(Cxx)
+  add_subdirectory(Cxx)
 
 endif()
diff --git a/Source/CMakeLists.txt b/Source/CMakeLists.txt
index 7e1586754..e8011d6fd 100644
--- a/Source/CMakeLists.txt
+++ b/Source/CMakeLists.txt
@@ -1,10 +1,8 @@
 # ...
-subdirs(
-  Common
-  Attribute
-  DataDictionary
-  DataStructureAndEncodingDefinition
-  InformationObjectDefinition
-  MediaStorageAndFileFormat
-  MessageExchangeDefinition
-  )
+add_subdirectory(Common)
+add_subdirectory(Attribute)
+add_subdirectory(DataDictionary)
+add_subdirectory(DataStructureAndEncodingDefinition)
+add_subdirectory(InformationObjectDefinition)
+add_subdirectory(MediaStorageAndFileFormat)
+add_subdirectory(MessageExchangeDefinition)
diff --git a/Testing/CMakeLists.txt b/Testing/CMakeLists.txt
index 66fc2da4f..79359b327 100644
--- a/Testing/CMakeLists.txt
+++ b/Testing/CMakeLists.txt
@@ -2,9 +2,7 @@
 find_package(DCMTK)
 find_package(DICOM3TOOLS)
 
-subdirs(
-  Source
-  )
+add_subdirectory(Source)
 
 #-----------------------------------------------------------------------------
 # Here is one cool test: you can pretty much test all configuration using
diff --git a/Testing/Source/CMakeLists.txt b/Testing/Source/CMakeLists.txt
index 6d1a4649c..e7986b787 100644
--- a/Testing/Source/CMakeLists.txt
+++ b/Testing/Source/CMakeLists.txt
@@ -8,12 +8,10 @@ get_directory_property(gdcm_data_image_filenames_glob DIRECTORY Data DEFINITION
 get_directory_property(gdcm_data_filenames_glob DIRECTORY Data DEFINITION GDCM_DATA_FILENAMES_GLOB)
 get_directory_property(black_list_reader DIRECTORY Data DEFINITION BLACK_LIST_READER)
 
-subdirs(
-  Attribute
-  Common
-  DataDictionary
-  DataStructureAndEncodingDefinition
-  InformationObjectDefinition
-  MediaStorageAndFileFormat
-  MessageExchangeDefinition
-)
+add_subdirectory(Attribute)
+add_subdirectory(Common)
+add_subdirectory(DataDictionary)
+add_subdirectory(DataStructureAndEncodingDefinition)
+add_subdirectory(InformationObjectDefinition)
+add_subdirectory(MediaStorageAndFileFormat)
+add_subdirectory(MessageExchangeDefinition)
diff --git a/Testing/Source/Common/CMakeLists.txt b/Testing/Source/Common/CMakeLists.txt
index 5fee2e107..1577b6b2a 100644
--- a/Testing/Source/Common/CMakeLists.txt
+++ b/Testing/Source/Common/CMakeLists.txt
@@ -1,5 +1,5 @@
-subdirs(Cxx)
+add_subdirectory(Cxx)
 
 if(GDCM_WRAP_PYTHON)
-  subdirs(Python)
+  add_subdirectory(Python)
 endif()
diff --git a/Testing/Source/DataDictionary/CMakeLists.txt b/Testing/Source/DataDictionary/CMakeLists.txt
index 5fee2e107..1577b6b2a 100644
--- a/Testing/Source/DataDictionary/CMakeLists.txt
+++ b/Testing/Source/DataDictionary/CMakeLists.txt
@@ -1,5 +1,5 @@
-subdirs(Cxx)
+add_subdirectory(Cxx)
 
 if(GDCM_WRAP_PYTHON)
-  subdirs(Python)
+  add_subdirectory(Python)
 endif()
diff --git a/Testing/Source/DataStructureAndEncodingDefinition/CMakeLists.txt b/Testing/Source/DataStructureAndEncodingDefinition/CMakeLists.txt
index 2e31593f3..583adbe2f 100644
--- a/Testing/Source/DataStructureAndEncodingDefinition/CMakeLists.txt
+++ b/Testing/Source/DataStructureAndEncodingDefinition/CMakeLists.txt
@@ -1,9 +1,9 @@
-subdirs(Cxx)
+add_subdirectory(Cxx)
 
 if(GDCM_WRAP_PYTHON)
-  subdirs(Python)
+  add_subdirectory(Python)
 endif()
 
 if(GDCM_WRAP_JAVA)
-  subdirs(Java)
+  add_subdirectory(Java)
 endif()
diff --git a/Testing/Source/InformationObjectDefinition/CMakeLists.txt b/Testing/Source/InformationObjectDefinition/CMakeLists.txt
index 5fee2e107..1577b6b2a 100644
--- a/Testing/Source/InformationObjectDefinition/CMakeLists.txt
+++ b/Testing/Source/InformationObjectDefinition/CMakeLists.txt
@@ -1,5 +1,5 @@
-subdirs(Cxx)
+add_subdirectory(Cxx)
 
 if(GDCM_WRAP_PYTHON)
-  subdirs(Python)
+  add_subdirectory(Python)
 endif()
diff --git a/Testing/Source/MediaStorageAndFileFormat/CMakeLists.txt b/Testing/Source/MediaStorageAndFileFormat/CMakeLists.txt
index 515862320..afe32837e 100644
--- a/Testing/Source/MediaStorageAndFileFormat/CMakeLists.txt
+++ b/Testing/Source/MediaStorageAndFileFormat/CMakeLists.txt
@@ -1,10 +1,10 @@
 # Always
-subdirs(Cxx)
+add_subdirectory(Cxx)
 
 if(GDCM_WRAP_PYTHON)
-  subdirs(Python)
+  add_subdirectory(Python)
 endif()
 
 if(GDCM_WRAP_CSHARP)
-  subdirs(Csharp)
+  add_subdirectory(Csharp)
 endif()
diff --git a/Testing/Source/MessageExchangeDefinition/CMakeLists.txt b/Testing/Source/MessageExchangeDefinition/CMakeLists.txt
index ccbaece9f..35f9732a9 100644
--- a/Testing/Source/MessageExchangeDefinition/CMakeLists.txt
+++ b/Testing/Source/MessageExchangeDefinition/CMakeLists.txt
@@ -1 +1 @@
-subdirs(Cxx)
+add_subdirectory(Cxx)
diff --git a/Utilities/CMakeLists.txt b/Utilities/CMakeLists.txt
index ab685cb56..054ec525b 100644
--- a/Utilities/CMakeLists.txt
+++ b/Utilities/CMakeLists.txt
@@ -8,7 +8,7 @@ if(NOT GDCM_USE_SYSTEM_LJPEG)
   set(JPEG_INSTALL_BIN_DIR      ${GDCM_INSTALL_BIN_DIR})
   set(JPEG_INSTALL_LIB_DIR      ${GDCM_INSTALL_LIB_DIR})
   set(JPEG_INSTALL_INCLUDE_DIR  ${GDCM_INSTALL_INCLUDE_DIR}/gdcmjpeg)
-  subdirs(gdcmjpeg)
+  add_subdirectory(gdcmjpeg)
 endif()
 
 # Do expat
@@ -18,7 +18,7 @@ if(NOT GDCM_USE_SYSTEM_EXPAT)
   set(EXPAT_INSTALL_NO_LIBRARIES ${GDCM_INSTALL_NO_LIBRARIES})
   set(EXPAT_INSTALL_BIN_DIR      ${GDCM_INSTALL_BIN_DIR})
   set(EXPAT_INSTALL_LIB_DIR      ${GDCM_INSTALL_LIB_DIR})
-  subdirs(gdcmexpat)
+  add_subdirectory(gdcmexpat)
 endif()
 
 # Do openjpeg (jpeg2000 implementation)
@@ -29,7 +29,7 @@ if(NOT GDCM_USE_SYSTEM_OPENJPEG)
   set(OPENJPEG_INSTALL_BIN_DIR      ${GDCM_INSTALL_BIN_DIR})
   set(OPENJPEG_INSTALL_LIB_DIR      ${GDCM_INSTALL_LIB_DIR})
   set(OPENJPEG_INSTALL_INCLUDE_DIR  ${GDCM_INSTALL_INCLUDE_DIR}/gdcmopenjpeg)
-  subdirs(gdcmopenjpeg)
+  add_subdirectory(gdcmopenjpeg)
   mark_as_advanced(BUILD_JPIP BUILD_JPWL BUILD_CODEC BUILD_DOC BUILD_MJ2 BUILD_PKGCONFIG_FILES BUILD_SHARED_LIBS BUILD_THIRDPARTY OPJ_DATA_ROOT OPJ_DISABLE_TPSOT_FIX)
 endif()
 
@@ -42,7 +42,7 @@ if(NOT GDCM_USE_SYSTEM_CHARLS)
   set(CHARLS_INSTALL_BIN_DIR      ${GDCM_INSTALL_BIN_DIR})
   set(CHARLS_INSTALL_LIB_DIR      ${GDCM_INSTALL_LIB_DIR})
   set(CHARLS_INSTALL_INCLUDE_DIR  ${GDCM_INSTALL_INCLUDE_DIR}/gdcmcharls)
-  subdirs(gdcmcharls)
+  add_subdirectory(gdcmcharls)
 endif()
 endif()
 
@@ -54,7 +54,7 @@ if(NOT GDCM_USE_SYSTEM_MD5)
   set(MD5_INSTALL_NO_LIBRARIES ${GDCM_INSTALL_NO_LIBRARIES})
   set(MD5_INSTALL_BIN_DIR      ${GDCM_INSTALL_BIN_DIR})
   set(MD5_INSTALL_LIB_DIR      ${GDCM_INSTALL_LIB_DIR})
-  subdirs(gdcmmd5)
+  add_subdirectory(gdcmmd5)
 endif()
 endif()
 
@@ -65,7 +65,7 @@ if(NOT GDCM_USE_SYSTEM_ZLIB)
   set(ZLIB_INSTALL_NO_LIBRARIES ${GDCM_INSTALL_NO_LIBRARIES})
   set(ZLIB_INSTALL_BIN_DIR      ${GDCM_INSTALL_BIN_DIR})
   set(ZLIB_INSTALL_LIB_DIR      ${GDCM_INSTALL_LIB_DIR})
-  subdirs(gdcmzlib)
+  add_subdirectory(gdcmzlib)
 endif()
 
 # Do getopt
@@ -75,10 +75,10 @@ if(WIN32 AND NOT CYGWIN)
   set(GETOPT_INSTALL_NO_LIBRARIES ${GDCM_INSTALL_NO_LIBRARIES})
   set(GETOPT_INSTALL_BIN_DIR      ${GDCM_INSTALL_BIN_DIR})
   set(GETOPT_INSTALL_LIB_DIR      ${GDCM_INSTALL_LIB_DIR})
-  subdirs(getopt)
+  add_subdirectory(getopt)
 endif()
 
-subdirs(doxygen)
+add_subdirectory(doxygen)
 
 # you could be running mingw32 on linux in which case you do NOT want the gdcmuuid lib
 APPEND_COPYRIGHT(${CMAKE_CURRENT_SOURCE_DIR}/gdcmuuid/COPYING)
@@ -88,14 +88,14 @@ if(NOT WIN32 AND NOT MINGW)
     set(UUID_INSTALL_NO_LIBRARIES ${GDCM_INSTALL_NO_LIBRARIES})
     set(UUID_INSTALL_BIN_DIR      ${GDCM_INSTALL_BIN_DIR})
     set(UUID_INSTALL_LIB_DIR      ${GDCM_INSTALL_LIB_DIR})
-    subdirs(gdcmuuid)
+    add_subdirectory(gdcmuuid)
   endif()
 endif()
 
 APPEND_COPYRIGHT(${CMAKE_CURRENT_SOURCE_DIR}/pvrg/COPYING)
 if(GDCM_USE_PVRG)
   if(NOT GDCM_USE_SYSTEM_PVRG)
-    subdirs(pvrg)
+    add_subdirectory(pvrg)
   endif()
 endif()
 
@@ -116,7 +116,7 @@ APPEND_COPYRIGHT(${CMAKE_CURRENT_SOURCE_DIR}/C99/COPYING)
 #endif()
 
 #if(GDCM_USE_KWSTYLE)
-  subdirs(KWStyle)
+  add_subdirectory(KWStyle)
 #endif()
 
 if(NOT GDCM_USE_SYSTEM_SOCKETXX)
@@ -125,7 +125,7 @@ if(NOT GDCM_USE_SYSTEM_SOCKETXX)
   set(SOCKETXX_INSTALL_BIN_DIR      ${GDCM_INSTALL_BIN_DIR})
   set(SOCKETXX_INSTALL_LIB_DIR      ${GDCM_INSTALL_LIB_DIR})
   set(SOCKETXX_INSTALL_INCLUDE_DIR  ${GDCM_INSTALL_INCLUDE_DIR}/socketxx)
-  subdirs(socketxx)
+  add_subdirectory(socketxx)
 endif()
 
 add_subdirectory(gdcmrle)
diff --git a/Utilities/VTK/CMakeLists.txt b/Utilities/VTK/CMakeLists.txt
index 0431b3ea2..6c3fed0e7 100644
--- a/Utilities/VTK/CMakeLists.txt
+++ b/Utilities/VTK/CMakeLists.txt
@@ -814,15 +814,15 @@ if(GDCM_WRAP_PYTHON)
 endif()
 
 if(BUILD_TESTING)
-  subdirs(Testing)
+  add_subdirectory(Testing)
 endif()
 
 if(BUILD_APPLICATIONS)
-  subdirs(Applications)
+  add_subdirectory(Applications)
 endif()
 
 if(BUILD_EXAMPLES)
-  subdirs(Examples)
+  add_subdirectory(Examples)
 endif()
 
 if(GDCM_USE_PARAVIEW)
diff --git a/Utilities/VTK/Examples/CMakeLists.txt b/Utilities/VTK/Examples/CMakeLists.txt
index 0cee6f2e5..9e52e3446 100644
--- a/Utilities/VTK/Examples/CMakeLists.txt
+++ b/Utilities/VTK/Examples/CMakeLists.txt
@@ -1,14 +1,14 @@
-#subdirs(Cxx Python)
-subdirs(Cxx)
+#add_subdirectory(Cxx Python)
+add_subdirectory(Cxx)
 
 if(GDCM_WRAP_CSHARP)
-  subdirs(Csharp)
+  add_subdirectory(Csharp)
 endif()
 
 if(GDCM_WRAP_JAVA)
   if(VTK_WRAP_JAVA)
     if(EXISTS ${GDCM_VTK_JAVA_JAR})
-      subdirs(Java)
+      add_subdirectory(Java)
     endif()
   endif()
 endif()
diff --git a/Utilities/VTK/Testing/CMakeLists.txt b/Utilities/VTK/Testing/CMakeLists.txt
index a06b19589..5118d2743 100644
--- a/Utilities/VTK/Testing/CMakeLists.txt
+++ b/Utilities/VTK/Testing/CMakeLists.txt
@@ -1,13 +1,13 @@
-subdirs(Cxx)
+add_subdirectory(Cxx)
 
 if(VTK_WRAP_PYTHON)
-  subdirs(Python)
+  add_subdirectory(Python)
 endif()
 
 if(GDCM_WRAP_JAVA)
   if(VTK_WRAP_JAVA)
     if(EXISTS ${GDCM_VTK_JAVA_JAR})
-      subdirs(Java)
+      add_subdirectory(Java)
     endif()
   endif()
 endif()
diff --git a/Utilities/doxygen/CMakeLists.txt b/Utilities/doxygen/CMakeLists.txt
index e192f34a3..55a28e31c 100644
--- a/Utilities/doxygen/CMakeLists.txt
+++ b/Utilities/doxygen/CMakeLists.txt
@@ -221,7 +221,7 @@ ${CMAKE_CURRENT_BINARY_DIR}/latex/Makefile
     if(GDCM_VTK_DOCUMENTATION)
       set(BUILD_DOCUMENTATION 1)
     endif()
-    subdirs(vtk)
+    add_subdirectory(vtk)
   endif()
 endif()
 
diff --git a/Utilities/gdcmexpat/CMakeLists.txt b/Utilities/gdcmexpat/CMakeLists.txt
index 9c86fb569..a1685476d 100644
--- a/Utilities/gdcmexpat/CMakeLists.txt
+++ b/Utilities/gdcmexpat/CMakeLists.txt
@@ -45,4 +45,4 @@ configure_file(${CMAKE_CURRENT_SOURCE_DIR}/expat_mangle.h.in
 
 # for expat_config.h
 include_directories(BEFORE ${CMAKE_CURRENT_BINARY_DIR})
-subdirs(lib)
+add_subdirectory(lib)
diff --git a/Utilities/gdcmjpeg/CMakeLists.txt b/Utilities/gdcmjpeg/CMakeLists.txt
index c687acd09..bfcc94b88 100644
--- a/Utilities/gdcmjpeg/CMakeLists.txt
+++ b/Utilities/gdcmjpeg/CMakeLists.txt
@@ -170,7 +170,9 @@ endforeach()
 # I could not get the depencencies in CMake to work properly so instead
 # have multiple directory for each target that will ensure proper recompilation
 # of the objects files
-subdirs(8 12 16)
+add_subdirectory(8)
+add_subdirectory(12)
+add_subdirectory(16)
 
 if(NOT JPEG_INSTALL_NO_DEVELOPMENT)
   file(GLOB header_files "*.h")
diff --git a/Wrapping/CMakeLists.txt b/Wrapping/CMakeLists.txt
index 89e0f3fdb..aca078b13 100644
--- a/Wrapping/CMakeLists.txt
+++ b/Wrapping/CMakeLists.txt
@@ -1,20 +1,20 @@
 # python
 if(GDCM_WRAP_PYTHON)
-  subdirs(Python)
+  add_subdirectory(Python)
 endif()
 # java
 if(GDCM_WRAP_JAVA)
-  subdirs(Java)
+  add_subdirectory(Java)
 endif()
 # php
 if(GDCM_WRAP_PHP)
-  subdirs(PHP)
+  add_subdirectory(PHP)
 endif()
 # perl
 if(GDCM_WRAP_PERL)
-  subdirs(Perl)
+  add_subdirectory(Perl)
 endif()
 # C#
 if(GDCM_WRAP_CSHARP)
-#  subdirs(Csharp)
+#  add_subdirectory(Csharp)
 endif()
-- 
2.20.1