From 31c11e61187f6e51d4686bb155eb2728713481bb Mon Sep 17 00:00:00 2001
From: Steven Murray <Steven.Murray@cern.ch>
Date: Mon, 2 Oct 2017 23:08:47 +0200
Subject: [PATCH] Move enabling and finding of OCCI support to top
 CMakeLists.txt file

---
 CMakeLists.txt           | 15 +++++++++++++++
 catalogue/CMakeLists.txt | 16 ++--------------
 2 files changed, 17 insertions(+), 14 deletions(-)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 2a7e627c49..7761f0c8d3 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -109,6 +109,21 @@ ELSE(DEFINED PackageOnly)
   include_directories(${PROJECT_SOURCE_DIR})
   include_directories(${CMAKE_BINARY_DIR})
 
+  # OCCI support is on by default
+  set (OCCI_SUPPORT ON)
+
+  # Switch OCCI support off if using gcc 5.1 or higher
+  if (CMAKE_COMPILER_IS_GNUCC)
+    if (GCC_VERSION VERSION_GREATER 5.0)
+      message (STATUS "Detected gcc >= 5.1 - Switching off OCCI support")
+      set (OCCI_SUPPORT OFF)
+    endif (GCC_VERSION VERSION_GREATER 5.0)
+  endif (CMAKE_COMPILER_IS_GNUCC)
+
+  if (OCCI_SUPPORT)
+    find_package (oracle-instantclient REQUIRED)
+  endif (OCCI_SUPPORT)
+
   if(BUILD_CMDLINE_ONLY)
     message(STATUS "Build cmdline only")
     add_subdirectory(cmdline)
diff --git a/catalogue/CMakeLists.txt b/catalogue/CMakeLists.txt
index 78425a90a3..ccffaf89fc 100644
--- a/catalogue/CMakeLists.txt
+++ b/catalogue/CMakeLists.txt
@@ -15,21 +15,9 @@
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 cmake_minimum_required (VERSION 2.6)
 
-# OCCI support is on by default
-set (OCCI_SUPPORT ON)
-
-# Switch OCCI support off if using gcc 5.1 or higher
-if (CMAKE_COMPILER_IS_GNUCC)
-  if (GCC_VERSION VERSION_GREATER 5.0)
-    message(STATUS "Detected gcc >= 5.1 - Switching off OCCI support")
-    set (OCCI_SUPPORT OFF)
-  endif (GCC_VERSION VERSION_GREATER 5.0)
-endif (CMAKE_COMPILER_IS_GNUCC)
-
-if(OCCI_SUPPORT)
-  find_package (oracle-instantclient REQUIRED)
+if (OCCI_SUPPORT)
   include_directories (${ORACLE-INSTANTCLIENT_INCLUDE_DIRS})
-endif(OCCI_SUPPORT)
+endif (OCCI_SUPPORT)
 
 set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wshadow")
 
-- 
GitLab