From dcfd533b41b29bb50b5fa7f8b4439c3619a86ca2 Mon Sep 17 00:00:00 2001
From: Julien Malik <julien.malik@c-s.fr>
Date: Wed, 23 Feb 2011 20:08:51 +0100
Subject: [PATCH] COMP: fix compilation issues with CUDA

---
 CMakeLists.txt                           | 6 +++---
 Code/BasicFilters/CMakeLists.txt         | 5 ++++-
 Code/BasicFilters/GPUCuda/CMakeLists.txt | 4 ++--
 Code/Hyperspectral/CMakeLists.txt        | 5 ++++-
 Testing/CMakeLists.txt                   | 4 ++--
 5 files changed, 15 insertions(+), 9 deletions(-)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 28c2db78a7..5d3079a3bf 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -21,11 +21,11 @@ FIND_PACKAGE(OTB)
     MESSAGE(FATAL_ERROR "OTB not found.  Please set OTB_DIR")
 ENDIF(OTB_FOUND)
 
-OPTION(OTB_USE_CUBLAS "Use Cuda CUBLAS library." OFF)
-IF(OTB_USE_CUBLAS)
+OPTION(OTB_USE_CUDA "Use Cuda CUBLAS library." OFF)
+IF(OTB_USE_CUDA)
   FIND_PACKAGE(CUDA)
   INCLUDE_DIRECTORIES(${CUDA_INCLUDE_DIRS})
-ENDIF(OTB_USE_CUBLAS)
+ENDIF(OTB_USE_CUDA)
 
 INCLUDE_DIRECTORIES(
 ${Hyperspectral_SOURCE_DIR}/Code/BasicFilters
diff --git a/Code/BasicFilters/CMakeLists.txt b/Code/BasicFilters/CMakeLists.txt
index 5429779534..f43b260093 100644
--- a/Code/BasicFilters/CMakeLists.txt
+++ b/Code/BasicFilters/CMakeLists.txt
@@ -1 +1,4 @@
-ADD_SUBDIRECTORY(GPUCuda)
+IF(OTB_USE_CUDA)
+  ADD_SUBDIRECTORY(GPUCuda)
+ENDIF(OTB_USE_CUDA)
+
diff --git a/Code/BasicFilters/GPUCuda/CMakeLists.txt b/Code/BasicFilters/GPUCuda/CMakeLists.txt
index 0c8e46cc76..5a6f91c09d 100644
--- a/Code/BasicFilters/GPUCuda/CMakeLists.txt
+++ b/Code/BasicFilters/GPUCuda/CMakeLists.txt
@@ -8,6 +8,6 @@ IF(OTB_LIBRARY_PROPERTIES)
   SET_TARGET_PROPERTIES(OTBBasicFiltersGPUCuda PROPERTIES ${OTB_LIBRARY_PROPERTIES})
 ENDIF(OTB_LIBRARY_PROPERTIES)
 
-IF(OTB_USE_CUBLAS)
+IF(OTB_USE_CUDA)
   CUDA_ADD_CUBLAS_TO_TARGET( OTBBasicFiltersGPUCuda )
-ENDIF(OTB_USE_CUBLAS)
+ENDIF(OTB_USE_CUDA)
diff --git a/Code/Hyperspectral/CMakeLists.txt b/Code/Hyperspectral/CMakeLists.txt
index 5429779534..f43b260093 100644
--- a/Code/Hyperspectral/CMakeLists.txt
+++ b/Code/Hyperspectral/CMakeLists.txt
@@ -1 +1,4 @@
-ADD_SUBDIRECTORY(GPUCuda)
+IF(OTB_USE_CUDA)
+  ADD_SUBDIRECTORY(GPUCuda)
+ENDIF(OTB_USE_CUDA)
+
diff --git a/Testing/CMakeLists.txt b/Testing/CMakeLists.txt
index 7f26470ee5..c01138af91 100644
--- a/Testing/CMakeLists.txt
+++ b/Testing/CMakeLists.txt
@@ -287,7 +287,7 @@ ADD_TEST(hyTvVCAImageFilter_AVIRIS
 ###################
 ## Cuda
 ###################
-IF( OTB_USE_CUBLAS )
+IF( OTB_USE_CUDA )
 
 SET( otbHyperCublasTests1_SRC
   otbCublasStreamingStatisticsVectorImageFilter.cxx
@@ -340,7 +340,7 @@ ADD_TEST(bfTvCudaFullyConstrainedLeastSquareImageFilter_AVIRIS512_block512
          1 # stream size in MB
          )
 
-ENDIF( OTB_USE_CUBLAS )
+ENDIF( OTB_USE_CUDA )
 
 ###################
 ## Anomaly detection
-- 
GitLab