From 82c3fc5d180c2a2d7d9b427d46c1bbb2c719fb1e Mon Sep 17 00:00:00 2001
From: Marcel Loose <loose@astron.nl>
Date: Thu, 9 Jul 2009 09:06:10 +0000
Subject: [PATCH] Bug 1310: New FindCPPLapack macro. Several small fixes

---
 .gitattributes                |  1 +
 CMake/FindBlitz.cmake         |  3 ++-
 CMake/FindCPPLapack.cmake     | 45 +++++++++++++++++++++++++++++++++++
 CMake/FindPQXX.cmake          |  3 ++-
 CMake/FindPVSS.cmake          |  4 ++++
 CMake/MACAddProtocol.cmake    |  1 +
 CMake/variants/variants.rs002 |  3 +++
 LCS/Blob/CMakeLists.txt       |  1 +
 LCS/Blob/configure.in         |  1 +
 lofar_config.h.cmake          |  9 +++++++
 10 files changed, 69 insertions(+), 2 deletions(-)
 create mode 100644 CMake/FindCPPLapack.cmake

diff --git a/.gitattributes b/.gitattributes
index 7f932e9df0f..a2d3bbcd2bb 100644
--- a/.gitattributes
+++ b/.gitattributes
@@ -161,6 +161,7 @@ CEP/Pipeline/bootstrap -text
 CEP/Pipeline/library/lioff.clusterdesc -text
 CEP/Pipeline/library/makevds.bash -text
 CMake/FindBlitz.cmake -text
+CMake/FindCPPLapack.cmake -text
 CMake/makeversion -text
 CMake/variants/variants.bgfen0 -text
 CMake/variants/variants.rs002 -text
diff --git a/CMake/FindBlitz.cmake b/CMake/FindBlitz.cmake
index 3dcdd239729..33c0131c430 100644
--- a/CMake/FindBlitz.cmake
+++ b/CMake/FindBlitz.cmake
@@ -34,7 +34,8 @@ if(NOT BLITZ_FOUND)
 
   find_path(BLITZ_INCLUDE_DIR blitz/blitz.h)
   find_library(BLITZ_LIBRARY blitz)
-
+  mark_as_advanced(BLITZ_INCLUDE_DIR BLITZ_LIBRARY)
+  
   include(FindPackageHandleStandardArgs)
   find_package_handle_standard_args(Blitz DEFAULT_MSG
     BLITZ_LIBRARY BLITZ_INCLUDE_DIR)
diff --git a/CMake/FindCPPLapack.cmake b/CMake/FindCPPLapack.cmake
new file mode 100644
index 00000000000..f20cc0d3149
--- /dev/null
+++ b/CMake/FindCPPLapack.cmake
@@ -0,0 +1,45 @@
+# $Id: FindCPPLapack.cmake 13415 2009-06-17 12:51:37Z loose $
+#
+# Copyright (C) 2008-2009
+# ASTRON (Netherlands Foundation for Research in Astronomy)
+# P.O.Box 2, 7990 AA Dwingeloo, The Netherlands, seg@astron.nl
+#
+# This program 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 2 of the License, or
+# (at your option) any later version.
+#
+# This program 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 this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+
+# Try to find CPPLapack, a C++ class wrapper for BLAS and LAPACK.
+#
+# This will define:
+#  
+#  CPPLAPACK_FOUND        - system has CPPLapack
+#  CPPLAPACK_INCLUDE_DIR  - the CPPLapack include directory (cached)
+#  CPPLAPACK_INCLUDE_DIRS - the CPPLapack include directories
+#                           (identical to CPPLAPACK_INCLUDE_DIR)
+#  CPPLAPACK_LIBRARIES    - libraries that CPPLapack depends upon
+
+if(NOT CPPLAPACK_FOUND)
+
+  find_path(CPPLAPACK_INCLUDE_DIR cpplapack.h)
+  find_library(LAPACK_LIBRARY lapack)
+  find_library(BLAS_LIBRARY blas)
+  mark_as_advanced(CPPLAPACK_INCLUDE_DIR LAPACK_LIBRARY BLAS_LIBRARY)
+
+  include(FindPackageHandleStandardArgs)
+  find_package_handle_standard_args(CPPLapack DEFAULT_MSG
+    CPPLAPACK_INCLUDE_DIR LAPACK_LIBRARY BLAS_LIBRARY)
+
+  set(CPPLAPACK_INCLUDE_DIRS ${CPPLAPACK_INCLUDE_DIR})
+  set(CPPLAPACK_LIBRARIES ${LAPACK_LIBRARY} ${BLAS_LIBRARY})
+
+endif(NOT CPPLAPACK_FOUND)
diff --git a/CMake/FindPQXX.cmake b/CMake/FindPQXX.cmake
index 003f007deab..44479ee95ac 100644
--- a/CMake/FindPQXX.cmake
+++ b/CMake/FindPQXX.cmake
@@ -35,7 +35,8 @@ if(NOT PQXX_FOUND)
   find_path(PQXX_INCLUDE_DIR pqxx/pqxx)
   find_library(PQXX_LIBRARY pqxx)
   find_library(PQ_LIBRARY pq)
-
+  mark_as_advanced(PQXX_INCLUDE_DIR PQXX_LIBRARY PQ_LIBRARY)
+  
   include(FindPackageHandleStandardArgs)
   find_package_handle_standard_args(PQXX DEFAULT_MSG
     PQXX_LIBRARY PQ_LIBRARY PQXX_INCLUDE_DIR)
diff --git a/CMake/FindPVSS.cmake b/CMake/FindPVSS.cmake
index 25dacd61c6a..20772a4ac1b 100644
--- a/CMake/FindPVSS.cmake
+++ b/CMake/FindPVSS.cmake
@@ -74,6 +74,7 @@ if(NOT PVSS_FOUND)
     NAMES VersInfo.mk
     PATHS ENV PVSSHOME
     PATH_SUFFIXES api)
+  mark_as_advanced(PVSS_VERSINFO_MK)
   if(NOT PVSS_VERSINFO_MK)
     set(pvss_version "V37_304")
   else()
@@ -102,6 +103,9 @@ if(NOT PVSS_FOUND)
     list(APPEND pvss_check_list PVSS_${lib}_LIBRARY)
   endforeach(lib Manager Messages Datapoint Basics bcm)
 
+  # Mark all variables in pvss_check_list as advanced
+  mark_as_advanced(${pvss_check_list})
+  
   # Handle the QUIETLY and REQUIRED arguments and set PVSS_FOUND to TRUE if
   # all elements of pvss_check_list are TRUE.
   include(FindPackageHandleStandardArgs)
diff --git a/CMake/MACAddProtocol.cmake b/CMake/MACAddProtocol.cmake
index 5727f08c9a7..fe006e19e3d 100644
--- a/CMake/MACAddProtocol.cmake
+++ b/CMake/MACAddProtocol.cmake
@@ -34,6 +34,7 @@ macro(mac_add_protocol _protocol _templ_dir)
 
   # Search for the autogen program
   find_program(AUTOGEN_EXECUTABLE autogen)
+  mark_as_advanced(AUTOGEN_EXECUTABLE)
   if(NOT AUTOGEN_EXECUTABLE)
     message(FATAL_ERROR 
       "Could not find autogen - the Automated Program Generator")
diff --git a/CMake/variants/variants.rs002 b/CMake/variants/variants.rs002
index 52997fd0438..db6a6aba452 100644
--- a/CMake/variants/variants.rs002
+++ b/CMake/variants/variants.rs002
@@ -23,3 +23,6 @@ option(USE_BACKTRACE     "Use backtrace" OFF)
 
 # Where to find Postgres libraries
 set(PQXX_PREFIX_PATH /usr/local/pgsql)
+
+# Search Lapack in /usr first, because Lapack library in /usr/local is broken!
+set(CPPLAPACK_PREFIX_PATH /usr)
diff --git a/LCS/Blob/CMakeLists.txt b/LCS/Blob/CMakeLists.txt
index 83fdcd193d6..e3961d6cb05 100644
--- a/LCS/Blob/CMakeLists.txt
+++ b/LCS/Blob/CMakeLists.txt
@@ -39,6 +39,7 @@ lofar_add_package(${PROJECT_NAME} 1.0 DEPENDS Common)
 ## ---------------------------------------------------------------------------
 include(LofarFindPackage)
 lofar_find_package(Casacore COMPONENTS casa)
+lofar_find_package(Blitz)
 
 ## ---------------------------------------------------------------------------
 ## Generate configuration header file.
diff --git a/LCS/Blob/configure.in b/LCS/Blob/configure.in
index f1813997248..3dd663de410 100644
--- a/LCS/Blob/configure.in
+++ b/LCS/Blob/configure.in
@@ -53,6 +53,7 @@ dnl
 lofar_GENERAL
 lofar_INTERNAL(LCS/Common,Common,,1,Common/LofarTypedefs.h,,)
 lofar_AIPSPP(0,"-lcasa")
+lofar_BLITZ(0)
 
 dnl
 dnl Output Makefiles
diff --git a/lofar_config.h.cmake b/lofar_config.h.cmake
index 4789ef42799..15e5ff0a4bb 100644
--- a/lofar_config.h.cmake
+++ b/lofar_config.h.cmake
@@ -13,6 +13,12 @@
 /* Define to 1 if you have the <memory.h> header file. */
 #cmakedefine HAVE_MEMORY_H 1
 
+/* Define to 1 if you have the <net/ethernet.h> header file. */
+#cmakedefine HAVE_NET_ETHERNET_H 1
+
+/* Define to 1 if you have the <netinet/in.h> header file. */
+#cmakedefine HAVE_NETINET_IN_H 1
+
 /* Define to 1 if you have the <signal.h> header file. */
 #cmakedefine HAVE_SIGNAL_H 1
 
@@ -84,6 +90,9 @@
 /* Define if BG/L MPICH is installed */
 #cmakedefine HAVE_BGLMPICH 1
 
+/* Define if Blitz is installed */
+#cmakedefine HAVE_BLITZ 1
+
 /* Define if BOOST is installed */
 #cmakedefine HAVE_BOOST 1
 
-- 
GitLab