From 3022534fc45e21be1434da9a26945b120d2bc1ae Mon Sep 17 00:00:00 2001
From: Thomas Feuvrier <thomas.feuvrier@c-s.fr>
Date: Mon, 22 Sep 2008 12:29:01 +0000
Subject: [PATCH] COMP: Add OTB_IO_UTILITIES_DEPENDENT_LIBRARIES variable in
 the TARGET_LINK_LIBRARIES() command for Examples exe which have a link
 problem (with lib static).

---
 .../DataRepresentation/Image/CMakeLists.txt   | 28 +++++++++----------
 Examples/IO/CMakeLists.txt                    |  4 +--
 Examples/Iterators/CMakeLists.txt             |  4 +--
 Examples/MultiScale/CMakeLists.txt            |  6 ++--
 Examples/Tutorials/CMakeLists.txt             |  4 +--
 5 files changed, 23 insertions(+), 23 deletions(-)

diff --git a/Examples/DataRepresentation/Image/CMakeLists.txt b/Examples/DataRepresentation/Image/CMakeLists.txt
index 698a1b79ea..84b77dba41 100644
--- a/Examples/DataRepresentation/Image/CMakeLists.txt
+++ b/Examples/DataRepresentation/Image/CMakeLists.txt
@@ -2,43 +2,43 @@ PROJECT(ImageExamples)
 INCLUDE_REGULAR_EXPRESSION("^.*$")
 
 ADD_EXECUTABLE(Image1 Image1.cxx )
-TARGET_LINK_LIBRARIES(Image1 OTBCommon ITKCommon OTBIO ITKIO)
+TARGET_LINK_LIBRARIES(Image1 OTBCommon ITKCommon OTBIO ITKIO ${OTB_IO_UTILITIES_DEPENDENT_LIBRARIES})
 
 ADD_EXECUTABLE(Image2 Image2.cxx )
-TARGET_LINK_LIBRARIES(Image2 OTBCommon ITKCommon OTBIO ITKIO)
+TARGET_LINK_LIBRARIES(Image2 OTBCommon ITKCommon OTBIO ITKIO ${OTB_IO_UTILITIES_DEPENDENT_LIBRARIES})
 
 ADD_EXECUTABLE(Image3 Image3.cxx )
-TARGET_LINK_LIBRARIES(Image3 OTBCommon ITKCommon OTBIO ITKIO)
+TARGET_LINK_LIBRARIES(Image3 OTBCommon ITKCommon OTBIO ITKIO ${OTB_IO_UTILITIES_DEPENDENT_LIBRARIES})
 
 ADD_EXECUTABLE(Image4 Image4.cxx )
-TARGET_LINK_LIBRARIES(Image4 OTBCommon ITKCommon OTBIO ITKIO)
+TARGET_LINK_LIBRARIES(Image4 OTBCommon ITKCommon OTBIO ITKIO ${OTB_IO_UTILITIES_DEPENDENT_LIBRARIES})
 
 ADD_EXECUTABLE(Image5 Image5.cxx )
-TARGET_LINK_LIBRARIES(Image5 OTBCommon ITKCommon OTBIO ITKIO)
+TARGET_LINK_LIBRARIES(Image5 OTBCommon ITKCommon OTBIO ITKIO ${OTB_IO_UTILITIES_DEPENDENT_LIBRARIES})
 
 ADD_EXECUTABLE(Image6 Image6.cxx )
-TARGET_LINK_LIBRARIES(Image6 OTBCommon ITKCommon OTBIO ITKIO)
+TARGET_LINK_LIBRARIES(Image6 OTBCommon ITKCommon OTBIO ITKIO ${OTB_IO_UTILITIES_DEPENDENT_LIBRARIES})
 
 ADD_EXECUTABLE(RGBImage RGBImage.cxx )
-TARGET_LINK_LIBRARIES(RGBImage OTBCommon OTBIO ITKCommon ITKIO) 
+TARGET_LINK_LIBRARIES(RGBImage OTBCommon OTBIO ITKCommon ITKIO ${OTB_IO_UTILITIES_DEPENDENT_LIBRARIES})
 
 ADD_EXECUTABLE(VectorImage VectorImage.cxx )
-TARGET_LINK_LIBRARIES(VectorImage OTBCommon ITKCommon OTBIO ITKIO)
+TARGET_LINK_LIBRARIES(VectorImage OTBCommon ITKCommon OTBIO ITKIO ${OTB_IO_UTILITIES_DEPENDENT_LIBRARIES})
 
 ADD_EXECUTABLE(ImageAdaptor1 ImageAdaptor1.cxx )
-TARGET_LINK_LIBRARIES(ImageAdaptor1 OTBCommon ITKCommon OTBIO ITKIO)
+TARGET_LINK_LIBRARIES(ImageAdaptor1 OTBCommon ITKCommon OTBIO ITKIO ${OTB_IO_UTILITIES_DEPENDENT_LIBRARIES})
 
 ADD_EXECUTABLE(ImageAdaptor2 ImageAdaptor2.cxx )
-TARGET_LINK_LIBRARIES(ImageAdaptor2 OTBCommon ITKCommon OTBIO ITKIO)
+TARGET_LINK_LIBRARIES(ImageAdaptor2 OTBCommon ITKCommon OTBIO ITKIO ${OTB_IO_UTILITIES_DEPENDENT_LIBRARIES})
 
 ADD_EXECUTABLE(ImageAdaptor3 ImageAdaptor3.cxx )
-TARGET_LINK_LIBRARIES(ImageAdaptor3 OTBCommon ITKCommon OTBIO ITKIO)
+TARGET_LINK_LIBRARIES(ImageAdaptor3 OTBCommon ITKCommon OTBIO ITKIO ${OTB_IO_UTILITIES_DEPENDENT_LIBRARIES})
 
 ADD_EXECUTABLE(ImageAdaptor4 ImageAdaptor4.cxx )
-TARGET_LINK_LIBRARIES(ImageAdaptor4 OTBCommon ITKCommon OTBIO ITKIO)
+TARGET_LINK_LIBRARIES(ImageAdaptor4 OTBCommon ITKCommon OTBIO ITKIO ${OTB_IO_UTILITIES_DEPENDENT_LIBRARIES})
 
 ADD_EXECUTABLE(ImageListExample ImageListExample.cxx )
-TARGET_LINK_LIBRARIES(ImageListExample OTBCommon ITKCommon OTBIO ITKIO)
+TARGET_LINK_LIBRARIES(ImageListExample OTBCommon ITKCommon OTBIO ITKIO ${OTB_IO_UTILITIES_DEPENDENT_LIBRARIES})
 
 
 IF( NOT OTB_DISABLE_CXX_TESTING AND BUILD_TESTING )
@@ -99,6 +99,6 @@ ADD_TEST(Image6Test ${EXE_TESTS}
 
 
 ADD_EXECUTABLE(otbImageExamplesTests otbImageExamplesTests.cxx)
-TARGET_LINK_LIBRARIES(otbImageExamplesTests gdal ITKIO ITKAlgorithms ITKStatistics ITKCommon OTBBasicFilters OTBCommon OTBDisparityMap OTBIO OTBSpatialReasoning OTBChangeDetection OTBFeatureExtraction  OTBLearning  OTBMultiScale)
+TARGET_LINK_LIBRARIES(otbImageExamplesTests gdal ITKIO ITKAlgorithms ITKStatistics ITKCommon OTBBasicFilters OTBCommon OTBDisparityMap OTBIO OTBSpatialReasoning OTBChangeDetection OTBFeatureExtraction  OTBLearning  OTBMultiScale  ${OTB_IO_UTILITIES_DEPENDENT_LIBRARIES})
 
 ENDIF( NOT OTB_DISABLE_CXX_TESTING AND BUILD_TESTING )
diff --git a/Examples/IO/CMakeLists.txt b/Examples/IO/CMakeLists.txt
index 8b551d6e74..e2b99b1391 100644
--- a/Examples/IO/CMakeLists.txt
+++ b/Examples/IO/CMakeLists.txt
@@ -50,7 +50,7 @@ ADD_EXECUTABLE(MetadataExample MetadataExample.cxx )
 TARGET_LINK_LIBRARIES(MetadataExample OTBCommon OTBIO ITKCommon ITKIO)
 
 ADD_EXECUTABLE(DXFReaderExample DXFReaderExample.cxx )
-TARGET_LINK_LIBRARIES(DXFReaderExample OTBCommon OTBIO ITKCommon ITKIO dxf)
+TARGET_LINK_LIBRARIES(DXFReaderExample OTBCommon OTBIO ITKCommon ITKIO  ${OTB_IO_UTILITIES_DEPENDENT_LIBRARIES})
 
 ADD_EXECUTABLE(VectorDataIOExample VectorDataIOExample.cxx )
 TARGET_LINK_LIBRARIES(VectorDataIOExample OTBCommon OTBIO ITKCommon ITKIO)
@@ -142,6 +142,6 @@ ADD_TEST(DEMToImageGeneratorTest ${EXE_TESTS}
  
 
 ADD_EXECUTABLE(otbIOExamplesTests otbIOExamplesTests.cxx)
-TARGET_LINK_LIBRARIES(otbIOExamplesTests otbossim OTBBasicFilters OTBCommon OTBDisparityMap OTBIO OTBSpatialReasoning OTBChangeDetection OTBFeatureExtraction  OTBLearning  OTBMultiScale OTBProjections gdal ITKIO ITKAlgorithms ITKStatistics ITKCommon dxf otbossim)
+TARGET_LINK_LIBRARIES(otbIOExamplesTests otbossim OTBBasicFilters OTBCommon OTBDisparityMap OTBIO OTBSpatialReasoning OTBChangeDetection OTBFeatureExtraction  OTBLearning  OTBMultiScale OTBProjections ITKIO ITKAlgorithms ITKStatistics ITKCommon  ${OTB_IO_UTILITIES_DEPENDENT_LIBRARIES})
 
 ENDIF( NOT OTB_DISABLE_CXX_TESTING AND BUILD_TESTING )
diff --git a/Examples/Iterators/CMakeLists.txt b/Examples/Iterators/CMakeLists.txt
index 0877fdb6f9..6d6c3c5167 100644
--- a/Examples/Iterators/CMakeLists.txt
+++ b/Examples/Iterators/CMakeLists.txt
@@ -24,7 +24,7 @@ ADD_EXECUTABLE(NeighborhoodIterators3 NeighborhoodIterators3.cxx)
 TARGET_LINK_LIBRARIES(NeighborhoodIterators3 OTBIO OTBCommon ITKIO   )
 
 ADD_EXECUTABLE(NeighborhoodIterators6 NeighborhoodIterators6.cxx)
-TARGET_LINK_LIBRARIES(NeighborhoodIterators6 ITKAlgorithms ITKBasicFilters OTBIO OTBCommon ITKIO )
+TARGET_LINK_LIBRARIES(NeighborhoodIterators6 ITKAlgorithms ITKBasicFilters OTBIO OTBCommon ITKIO ${OTB_IO_UTILITIES_DEPENDENT_LIBRARIES})
 
 ADD_EXECUTABLE(ImageRegionIteratorWithIndex ImageRegionIteratorWithIndex.cxx)
 TARGET_LINK_LIBRARIES(ImageRegionIteratorWithIndex OTBIO OTBCommon ITKIO   )
@@ -194,6 +194,6 @@ ADD_TEST(ShapedNeighborhoodIterators2Test ${EXE_TESTS}
 
 
 ADD_EXECUTABLE(otbIteratorsExamplesTests otbIteratorsExamplesTests.cxx)
-TARGET_LINK_LIBRARIES(otbIteratorsExamplesTests gdal ITKIO ITKAlgorithms ITKStatistics ITKCommon OTBBasicFilters OTBCommon OTBDisparityMap OTBIO OTBSpatialReasoning OTBChangeDetection OTBFeatureExtraction  OTBLearning  OTBMultiScale)
+TARGET_LINK_LIBRARIES(otbIteratorsExamplesTests gdal ITKIO ITKAlgorithms ITKStatistics ITKCommon OTBBasicFilters OTBCommon OTBDisparityMap OTBIO OTBSpatialReasoning OTBChangeDetection OTBFeatureExtraction  OTBLearning  OTBMultiScale ${OTB_IO_UTILITIES_DEPENDENT_LIBRARIES})
 
 ENDIF( NOT OTB_DISABLE_CXX_TESTING AND BUILD_TESTING )
diff --git a/Examples/MultiScale/CMakeLists.txt b/Examples/MultiScale/CMakeLists.txt
index 51828ceb1e..bcdbbe7eca 100644
--- a/Examples/MultiScale/CMakeLists.txt
+++ b/Examples/MultiScale/CMakeLists.txt
@@ -8,11 +8,11 @@ ADD_EXECUTABLE(MorphologicalPyramidSynthesisFilterExample MorphologicalPyramidSy
 TARGET_LINK_LIBRARIES(MorphologicalPyramidSynthesisFilterExample OTBCommon OTBIO OTBMultiScale ITKCommon ITKIO)
 
 ADD_EXECUTABLE(MorphologicalPyramidSegmenterExample MorphologicalPyramidSegmenterExample.cxx )
-TARGET_LINK_LIBRARIES(MorphologicalPyramidSegmenterExample OTBCommon OTBIO OTBMultiScale ITKCommon ITKIO)
+TARGET_LINK_LIBRARIES(MorphologicalPyramidSegmenterExample OTBCommon OTBIO OTBMultiScale ITKCommon ITKIO  ${OTB_IO_UTILITIES_DEPENDENT_LIBRARIES})
 
 
 ADD_EXECUTABLE(MorphologicalPyramidSegmentationExample MorphologicalPyramidSegmentationExample.cxx )
-TARGET_LINK_LIBRARIES(MorphologicalPyramidSegmentationExample OTBCommon OTBIO OTBMultiScale ITKCommon ITKIO)
+TARGET_LINK_LIBRARIES(MorphologicalPyramidSegmentationExample OTBCommon OTBIO OTBMultiScale ITKCommon ITKIO ${OTB_IO_UTILITIES_DEPENDENT_LIBRARIES})
 
 
 
@@ -94,6 +94,6 @@ ADD_TEST(MorphologicalPyramidSegmenterExampleTest ${EXE_TESTS}
 
 
 ADD_EXECUTABLE(otbMultiScaleExamplesTests otbMultiScaleExamplesTests.cxx)
-TARGET_LINK_LIBRARIES(otbMultiScaleExamplesTests gdal ITKIO ITKAlgorithms ITKStatistics ITKCommon OTBBasicFilters OTBCommon OTBDisparityMap OTBIO OTBSpatialReasoning OTBChangeDetection OTBFeatureExtraction  OTBLearning  OTBMultiScale)
+TARGET_LINK_LIBRARIES(otbMultiScaleExamplesTests gdal ITKIO ITKAlgorithms ITKStatistics ITKCommon OTBBasicFilters OTBCommon OTBDisparityMap OTBIO OTBSpatialReasoning OTBChangeDetection OTBFeatureExtraction  OTBLearning  OTBMultiScale ${OTB_IO_UTILITIES_DEPENDENT_LIBRARIES})
 
 ENDIF( NOT OTB_DISABLE_CXX_TESTING AND BUILD_TESTING )
diff --git a/Examples/Tutorials/CMakeLists.txt b/Examples/Tutorials/CMakeLists.txt
index b7bb5b12ed..60dd61be27 100644
--- a/Examples/Tutorials/CMakeLists.txt
+++ b/Examples/Tutorials/CMakeLists.txt
@@ -2,7 +2,7 @@ PROJECT(TutorialsExamples)
 INCLUDE_REGULAR_EXPRESSION("^.*$")
 
 ADD_EXECUTABLE(HelloWorldOTB HelloWorldOTB.cxx )
-TARGET_LINK_LIBRARIES(HelloWorldOTB OTBCommon OTBIO)
+TARGET_LINK_LIBRARIES(HelloWorldOTB OTBCommon OTBIO ${OTB_IO_UTILITIES_DEPENDENT_LIBRARIES})
 
 ADD_EXECUTABLE(Pipeline Pipeline.cxx )
 TARGET_LINK_LIBRARIES(Pipeline OTBCommon OTBIO)
@@ -106,6 +106,6 @@ ADD_TEST( TutorialsOrthoFusionTest ${EXE_TESTS}
 
 
 ADD_EXECUTABLE(otbTutorialsExamplesTests otbTutorialsExamplesTests.cxx)
-TARGET_LINK_LIBRARIES(otbTutorialsExamplesTests gdal ITKIO ITKAlgorithms ITKStatistics ITKNumerics ITKCommon OTBBasicFilters OTBCommon OTBDisparityMap OTBIO OTBSpatialReasoning OTBChangeDetection OTBFeatureExtraction  OTBLearning  OTBMultiScale OTBFusion)
+TARGET_LINK_LIBRARIES(otbTutorialsExamplesTests gdal ITKIO ITKAlgorithms ITKStatistics ITKNumerics ITKCommon OTBBasicFilters OTBCommon OTBDisparityMap OTBIO OTBSpatialReasoning OTBChangeDetection OTBFeatureExtraction  OTBLearning  OTBMultiScale OTBFusion ${OTB_IO_UTILITIES_DEPENDENT_LIBRARIES})
 
 ENDIF( NOT OTB_DISABLE_CXX_TESTING AND BUILD_TESTING )
-- 
GitLab