From a00da5a3c8c90bc27e5d67547925d16498556c75 Mon Sep 17 00:00:00 2001
From: Guillaume Pasero <guillaume.pasero@c-s.fr>
Date: Thu, 19 Mar 2015 16:51:42 +0100
Subject: [PATCH] ENH: superbuild: avoid mixing variables set by user and
 superbuild ones

---
 SuperBuild/CMake/External_curl.cmake    |  2 +-
 SuperBuild/CMake/External_gdal.cmake    | 24 ++++++++++++------------
 SuperBuild/CMake/External_geotiff.cmake |  8 ++++----
 SuperBuild/CMake/External_swig.cmake    |  4 ++--
 SuperBuild/CMake/SuperBuild_Macro.cmake |  2 +-
 5 files changed, 20 insertions(+), 20 deletions(-)

diff --git a/SuperBuild/CMake/External_curl.cmake b/SuperBuild/CMake/External_curl.cmake
index 05ea1c14f2..85db8b0260 100644
--- a/SuperBuild/CMake/External_curl.cmake
+++ b/SuperBuild/CMake/External_curl.cmake
@@ -20,7 +20,7 @@ else()
   set(proj CURL)
   
   if(USE_SYSTEM_GEOS)
-    ADD_SUPERBUILD_CMAKE_VAR(ZLIB_SB_ROOT)
+    ADD_SUPERBUILD_CMAKE_VAR(ZLIB_ROOT)
   endif()
   
   #TODO: add openssl and other dependencies
diff --git a/SuperBuild/CMake/External_gdal.cmake b/SuperBuild/CMake/External_gdal.cmake
index 7fa59cb8de..592cfaaf05 100644
--- a/SuperBuild/CMake/External_gdal.cmake
+++ b/SuperBuild/CMake/External_gdal.cmake
@@ -19,20 +19,20 @@ else()
   # set proj back to its original value
   set(proj GDAL)
   
-  ADD_SUPERBUILD_CONFIGURE_VAR(TIFF_SB_ROOT     --with-libtiff)
-  ADD_SUPERBUILD_CONFIGURE_VAR(GEOTIFF_SB_ROOT  --with-geotiff)
-  ADD_SUPERBUILD_CONFIGURE_VAR(PNG_SB_ROOT      --with-png)
-  ADD_SUPERBUILD_CONFIGURE_VAR(JPEG_SB_ROOT     --with-jpeg)
-  ADD_SUPERBUILD_CONFIGURE_VAR(OPENJPEG_SB_ROOT --with-openjpeg)
-  ADD_SUPERBUILD_CONFIGURE_VAR(SQLITE_SB_ROOT   --with-sqlite3)
-  ADD_SUPERBUILD_CONFIGURE_VAR(ZLIB_SB_ROOT     --with-libz)
-  ADD_SUPERBUILD_CONFIGURE_VAR(EXPAT_SB_ROOT    --with-expat)
-  ADD_SUPERBUILD_CONFIGURE_VAR(LIBKML_SB_ROOT   --with-libkml)
-  ADD_SUPERBUILD_CONFIGURE_VAR(CURL_SB_ROOT     --with-curl)
+  ADD_SUPERBUILD_CONFIGURE_VAR(TIFF_ROOT     --with-libtiff)
+  ADD_SUPERBUILD_CONFIGURE_VAR(GEOTIFF_ROOT  --with-geotiff)
+  ADD_SUPERBUILD_CONFIGURE_VAR(PNG_ROOT      --with-png)
+  ADD_SUPERBUILD_CONFIGURE_VAR(JPEG_ROOT     --with-jpeg)
+  ADD_SUPERBUILD_CONFIGURE_VAR(OPENJPEG_ROOT --with-openjpeg)
+  ADD_SUPERBUILD_CONFIGURE_VAR(SQLITE_ROOT   --with-sqlite3)
+  ADD_SUPERBUILD_CONFIGURE_VAR(ZLIB_ROOT     --with-libz)
+  ADD_SUPERBUILD_CONFIGURE_VAR(EXPAT_ROOT    --with-expat)
+  ADD_SUPERBUILD_CONFIGURE_VAR(LIBKML_ROOT   --with-libkml)
+  ADD_SUPERBUILD_CONFIGURE_VAR(CURL_ROOT     --with-curl)
   if(MSVC)
-    ADD_SUPERBUILD_CONFIGURE_VAR(GEOS_SB_ROOT     --with-geos)
+    ADD_SUPERBUILD_CONFIGURE_VAR(GEOS_ROOT     --with-geos)
   else()
-    ADD_SUPERBUILD_CONFIGURE_VAR(GEOS_SB_ROOT     --with-geos "/bin/geos-config")
+    ADD_SUPERBUILD_CONFIGURE_VAR(GEOS_ROOT     --with-geos "/bin/geos-config")
   endif()
   
   #if(USE_SYSTEM_TIFF)
diff --git a/SuperBuild/CMake/External_geotiff.cmake b/SuperBuild/CMake/External_geotiff.cmake
index 39a98b09a8..8b60d7f9e8 100644
--- a/SuperBuild/CMake/External_geotiff.cmake
+++ b/SuperBuild/CMake/External_geotiff.cmake
@@ -29,10 +29,10 @@ else()
     ADD_SUPERBUILD_CMAKE_VAR(JPEG_INCLUDE_DIR)
     ADD_SUPERBUILD_CMAKE_VAR(JPEG_LIBRARY)
   else()
-    ADD_SUPERBUILD_CONFIGURE_VAR(TIFF_SB_ROOT --with-libtiff)
-    ADD_SUPERBUILD_CONFIGURE_VAR(PROJ_SB_ROOT --with-proj)
-    ADD_SUPERBUILD_CONFIGURE_VAR(ZLIB_SB_ROOT --with-zlib)
-    ADD_SUPERBUILD_CONFIGURE_VAR(JPEG_SB_ROOT --with-jpeg)
+    ADD_SUPERBUILD_CONFIGURE_VAR(TIFF_ROOT --with-libtiff)
+    ADD_SUPERBUILD_CONFIGURE_VAR(PROJ_ROOT --with-proj)
+    ADD_SUPERBUILD_CONFIGURE_VAR(ZLIB_ROOT --with-zlib)
+    ADD_SUPERBUILD_CONFIGURE_VAR(JPEG_ROOT --with-jpeg)
   endif()
   
     #if(MSVC)
diff --git a/SuperBuild/CMake/External_swig.cmake b/SuperBuild/CMake/External_swig.cmake
index 3643b6d59f..0e9c08ff87 100644
--- a/SuperBuild/CMake/External_swig.cmake
+++ b/SuperBuild/CMake/External_swig.cmake
@@ -50,8 +50,8 @@ else()
     # set proj back to its original value
     set(proj SWIG)
     
-    ADD_SUPERBUILD_CONFIGURE_VAR(PCRE_SB_ROOT --with-pcre-prefix)
-    ADD_SUPERBUILD_CONFIGURE_VAR(BOOST_SB_ROOT --with-boost)
+    ADD_SUPERBUILD_CONFIGURE_VAR(PCRE_ROOT --with-pcre-prefix)
+    ADD_SUPERBUILD_CONFIGURE_VAR(BOOST_ROOT --with-boost)
     
     ExternalProject_Add(${proj}
       PREFIX ${proj}
diff --git a/SuperBuild/CMake/SuperBuild_Macro.cmake b/SuperBuild/CMake/SuperBuild_Macro.cmake
index 081e2c380f..1c2d11282a 100644
--- a/SuperBuild/CMake/SuperBuild_Macro.cmake
+++ b/SuperBuild/CMake/SuperBuild_Macro.cmake
@@ -62,7 +62,7 @@ macro(SETUP_SUPERBUILD)
   set(${NEW_SB_PROJECT}_SB_BUILD_DIR ${CMAKE_BINARY_DIR}/${NEW_SB_PROJECT}/build)
   set(${NEW_SB_PROJECT}_SB_SRC ${CMAKE_BINARY_DIR}/${NEW_SB_PROJECT}/src/${NEW_SB_PROJECT})
   set(${NEW_SB_PROJECT}_SB_CONFIG)
-  set(${NEW_SB_PROJECT}_SB_ROOT ${SB_INSTALL_PREFIX})
+  set(_SB_${NEW_SB_PROJECT}_ROOT ${SB_INSTALL_PREFIX})
 endmacro(SETUP_SUPERBUILD)
 
 # Macro to include dependencies
-- 
GitLab