From bb66ca6e49da6e1328567d4d45ab4a9b84f75ca6 Mon Sep 17 00:00:00 2001
From: Jan David Mol <mol@astron.nl>
Date: Tue, 27 Jan 2015 14:31:11 +0000
Subject: [PATCH] Task #7342: Added FindQPID support to CMake, and updated
 lhn001,2 variant files to include QPID install locations

---
 .gitattributes                 |  1 +
 CMake/FindQPID.cmake           | 48 ++++++++++++++++++++++++++++++++++
 CMake/variants/variants.lhn001 |  2 ++
 CMake/variants/variants.lhn002 | 22 +---------------
 lofar_config.h.cmake           |  3 +++
 5 files changed, 55 insertions(+), 21 deletions(-)
 create mode 100644 CMake/FindQPID.cmake
 mode change 100644 => 120000 CMake/variants/variants.lhn002

diff --git a/.gitattributes b/.gitattributes
index 27be6b2a9d6..d7754d0f874 100644
--- a/.gitattributes
+++ b/.gitattributes
@@ -2217,6 +2217,7 @@ CMake/variants/variants.dop282 -text
 CMake/variants/variants.fs0 -text
 CMake/variants/variants.gpu01 -text
 CMake/variants/variants.gpu1 -text
+CMake/variants/variants.lhn002 -text
 CMake/variants/variants.node501 -text
 CMake/variants/variants.node502 -text
 CMake/variants/variants.node503 -text
diff --git a/CMake/FindQPID.cmake b/CMake/FindQPID.cmake
new file mode 100644
index 00000000000..b4ba292ffa0
--- /dev/null
+++ b/CMake/FindQPID.cmake
@@ -0,0 +1,48 @@
+# - Try to find QPID: Apache's implementation of the AMPQ protocol
+# Variables used by this module:
+#  QPID_ROOT_DIR     - QPID root directory
+# Variables defined by this module:
+#  QPID_FOUND        - system has QPID
+#  QPID_INCLUDE_DIR  - the QPID include directory (cached)
+#  QPID_INCLUDE_DIRS - the QPID include directories
+#                        (identical to QPID_INCLUDE_DIR)
+#  QPID_LIBRARY      - the QPID library (cached)
+#  QPID_LIBRARIES    - the QPID libraries
+#                        (identical to QPID_LIBRARY)
+
+# Copyright (C) 2015
+# ASTRON (Netherlands Institute for Radio Astronomy)
+# P.O.Box 2, 7990 AA Dwingeloo, The Netherlands
+#
+# This file is part of the LOFAR software suite.
+# The LOFAR software suite is free software: you can redistribute it and/or
+# modify it under the terms of the GNU General Public License as published
+# by the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# The LOFAR software suite is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License along
+# with the LOFAR software suite. If not, see <http://www.gnu.org/licenses/>.
+#
+# $Id$
+
+if(NOT QPID_FOUND)
+
+  find_path(QPID_INCLUDE_DIR qpid/messaging/Connection.h
+    HINTS ${QPID_ROOT_DIR} PATH_SUFFIXES include)
+  find_library(QPID_LIBRARY qpidmessaging
+    HINTS ${QPID_ROOT_DIR} PATH_SUFFIXES lib)
+  mark_as_advanced(QPID_INCLUDE_DIR QPID_LIBRARY)
+
+  include(FindPackageHandleStandardArgs)
+  find_package_handle_standard_args(QPID DEFAULT_MSG
+    QPID_LIBRARY QPID_INCLUDE_DIR)
+
+  set(QPID_INCLUDE_DIRS ${QPID_INCLUDE_DIR})
+  set(QPID_LIBRARIES ${QPID_LIBRARY})
+
+endif(NOT QPID_FOUND)
diff --git a/CMake/variants/variants.lhn001 b/CMake/variants/variants.lhn001
index 1b2617ece3e..ab8bf36cc2f 100644
--- a/CMake/variants/variants.lhn001
+++ b/CMake/variants/variants.lhn001
@@ -4,6 +4,8 @@ set(DAL_ROOT_DIR /opt/cep/dal/current)
 
 set(PYRAP_ROOT_DIR /opt/cep/pyrap)
 
+set(QPID_ROOT_DIR /opt/cep/qpid)
+
 set(WCSLIB_ROOT_DIR /opt/cep/wcslib)
 
 set(LOG4CXX_ROOT_DIR /opt/cep/LofIm/external/log4cxx)
diff --git a/CMake/variants/variants.lhn002 b/CMake/variants/variants.lhn002
deleted file mode 100644
index 1b2617ece3e..00000000000
--- a/CMake/variants/variants.lhn002
+++ /dev/null
@@ -1,21 +0,0 @@
-set(CASACORE_ROOT_DIR /opt/cep/casacore)
-set(CASAREST_ROOT_DIR /opt/cep/casarest)
-set(DAL_ROOT_DIR /opt/cep/dal/current)
-
-set(PYRAP_ROOT_DIR /opt/cep/pyrap)
-
-set(WCSLIB_ROOT_DIR /opt/cep/wcslib)
-
-set(LOG4CXX_ROOT_DIR /opt/cep/LofIm/external/log4cxx)
-set(LOG4CPLUS_ROOT_DIR /opt/cep/lofar/external/log4cplus)
-
-#set(ENV{JAVA_HOME} /usr/lib/jvm/java-1.5.0-sun)
-
-set(CTEST_CUSTOM_WARNING_EXCEPTION
-  "/log4cxx/helpers/objectptr.h:[0-9]+: warning: base class"
-  "/log4cxx/helpers/objectptr.h:[0-9]+: warning: dereferencing type-punned pointer"
-)
-
-# Drop the now default C++ debug compile flag -D_GLIBCXX_DEBUG, because Python
-# (or Boost.Python) barfs on it (glibc detected: python free(): invalid pointer)
-set(GNU_CXX_FLAGS_DEBUG  "-g")
diff --git a/CMake/variants/variants.lhn002 b/CMake/variants/variants.lhn002
new file mode 120000
index 00000000000..92890f596ce
--- /dev/null
+++ b/CMake/variants/variants.lhn002
@@ -0,0 +1 @@
+variants.lhn001
\ No newline at end of file
diff --git a/lofar_config.h.cmake b/lofar_config.h.cmake
index 4d2da086f79..a08d70c1d91 100644
--- a/lofar_config.h.cmake
+++ b/lofar_config.h.cmake
@@ -153,6 +153,9 @@
 /* Define if using Rational Purify */
 #cmakedefine HAVE_PURIFY 1
 
+/* Define if QPID is installed */
+#cmakedefine HAVE_QPID 1
+
 /* Define if readline is installed */
 #cmakedefine HAVE_READLINE 1
 
-- 
GitLab