From a294296740fe3fb8476d26d773d4c6535c009a3f Mon Sep 17 00:00:00 2001
From: Ger van Diepen <diepen@astron.nl>
Date: Fri, 6 Nov 2009 15:11:40 +0000
Subject: [PATCH] bug 1389: Added macros to find packages casacore can depend
 on

---
 .gitattributes          |  4 ++++
 CMake/FindBlas.cmake    | 45 +++++++++++++++++++++++++++++++++++++++
 CMake/FindCfitsio.cmake | 47 +++++++++++++++++++++++++++++++++++++++++
 CMake/FindLapack.cmake  | 45 +++++++++++++++++++++++++++++++++++++++
 CMake/FindWcslib.cmake  | 47 +++++++++++++++++++++++++++++++++++++++++
 5 files changed, 188 insertions(+)
 create mode 100644 CMake/FindBlas.cmake
 create mode 100644 CMake/FindCfitsio.cmake
 create mode 100644 CMake/FindLapack.cmake
 create mode 100644 CMake/FindWcslib.cmake

diff --git a/.gitattributes b/.gitattributes
index ef2f6c9e4a4..e28636df3d6 100644
--- a/.gitattributes
+++ b/.gitattributes
@@ -190,8 +190,12 @@ CEP/ParmDB/test/tsetupsourcedb.in_ms2.vds -text
 CEP/Pipeline/bootstrap -text
 CEP/Pipeline/library/lioff.clusterdesc -text
 CEP/Pipeline/library/makevds.bash -text
+CMake/FindBlas.cmake -text
 CMake/FindBlitz.cmake -text
 CMake/FindCPPLapack.cmake -text
+CMake/FindCfitsio.cmake -text
+CMake/FindLapack.cmake -text
+CMake/FindWcslib.cmake -text
 CMake/TODO -text
 CMake/makeCMakeCache -text
 CMake/makeversion -text
diff --git a/CMake/FindBlas.cmake b/CMake/FindBlas.cmake
new file mode 100644
index 00000000000..a8d646a7915
--- /dev/null
+++ b/CMake/FindBlas.cmake
@@ -0,0 +1,45 @@
+# $Id: FindBlas.cmake 13814 2009-08-20 11:55:06Z 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 Blas.
+#
+# This will define:
+#  
+#  BLAS_FOUND        - system has Blas
+#  BLAS_INCLUDE_DIR  - undefined
+#  BLAS_INCLUDE_DIRS - 
+#                         (identical to BLAS_INCLUDE_DIR)
+#  BLAS_LIBRARY      - the Blas library (cached)
+#  BLAS_LIBRARIES    - the Blas libraries
+#                         (identical to BLAS_LIBRARY)
+
+if(NOT BLAS_FOUND)
+
+  find_library(BLAS_LIBRARY blas)
+  mark_as_advanced(BLAS_LIBRARY)
+
+  include(FindPackageHandleStandardArgs)
+  set(custom_msg "Could NOT find Blas in ${CMAKE_PREFIX_PATH}")
+  find_package_handle_standard_args(Blas "${custom_msg}"
+    BLAS_LIBRARY)
+
+  set(BLAS_LIBRARIES ${BLAS_LIBRARY})
+
+endif(NOT BLAS_FOUND)
diff --git a/CMake/FindCfitsio.cmake b/CMake/FindCfitsio.cmake
new file mode 100644
index 00000000000..327d7b8d957
--- /dev/null
+++ b/CMake/FindCfitsio.cmake
@@ -0,0 +1,47 @@
+# $Id: FindCfitsio.cmake 13814 2009-08-20 11:55:06Z 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 Cfitsio.
+#
+# This will define:
+#  
+#  CFITSIO_FOUND        - system has Cfitsio
+#  CFITSIO_INCLUDE_DIR  - the Cfitsio include directory (cached)
+#  CFITSIO_INCLUDE_DIRS - the Cfitsio include directories
+#                         (identical to CFITSIO_INCLUDE_DIR)
+#  CFITSIO_LIBRARY      - the Cfitsio library (cached)
+#  CFITSIO_LIBRARIES    - the Cfitsio libraries
+#                         (identical to CFITSIO_LIBRARY)
+
+if(NOT CFITSIO_FOUND)
+
+  find_path(CFITSIO_INCLUDE_DIR fitsio.h)
+  find_library(CFITSIO_LIBRARY cfitsio)
+  mark_as_advanced(CFITSIO_INCLUDE_DIR CFITSIO_LIBRARY)
+
+  include(FindPackageHandleStandardArgs)
+  set(custom_msg "Could NOT find Cfitsio in ${CMAKE_PREFIX_PATH}")
+  find_package_handle_standard_args(Cfitsio "${custom_msg}"
+    CFITSIO_LIBRARY CFITSIO_INCLUDE_DIR)
+
+  set(CFITSIO_INCLUDE_DIRS ${CFITSIO_INCLUDE_DIR})
+  set(CFITSIO_LIBRARIES ${CFITSIO_LIBRARY})
+
+endif(NOT CFITSIO_FOUND)
diff --git a/CMake/FindLapack.cmake b/CMake/FindLapack.cmake
new file mode 100644
index 00000000000..9f245244cc8
--- /dev/null
+++ b/CMake/FindLapack.cmake
@@ -0,0 +1,45 @@
+# $Id: FindLapack.cmake 13814 2009-08-20 11:55:06Z 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 Lapack.
+#
+# This will define:
+#  
+#  LAPACK_FOUND        - system has Lapack
+#  LAPACK_INCLUDE_DIR  - undefined
+#  LAPACK_INCLUDE_DIRS - 
+#                         (identical to LAPACK_INCLUDE_DIR)
+#  LAPACK_LIBRARY      - the Lapack library (cached)
+#  LAPACK_LIBRARIES    - the Lapack libraries
+#                         (identical to LAPACK_LIBRARY)
+
+if(NOT LAPACK_FOUND)
+
+  find_library(LAPACK_LIBRARY lapack)
+  mark_as_advanced(LAPACK_LIBRARY)
+
+  include(FindPackageHandleStandardArgs)
+  set(custom_msg "Could NOT find Lapack in ${CMAKE_PREFIX_PATH}")
+  find_package_handle_standard_args(Lapack "${custom_msg}"
+    LAPACK_LIBRARY)
+
+  set(LAPACK_LIBRARIES ${LAPACK_LIBRARY})
+
+endif(NOT LAPACK_FOUND)
diff --git a/CMake/FindWcslib.cmake b/CMake/FindWcslib.cmake
new file mode 100644
index 00000000000..8cc662b4a13
--- /dev/null
+++ b/CMake/FindWcslib.cmake
@@ -0,0 +1,47 @@
+# $Id: FindWcslib.cmake 13814 2009-08-20 11:55:06Z 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 Wcslib.
+#
+# This will define:
+#  
+#  WCSLIB_FOUND        - system has Wcslib
+#  WCSLIB_INCLUDE_DIR  - the Wcslib include directory (cached)
+#  WCSLIB_INCLUDE_DIRS - the Wcslib include directories
+#                         (identical to WCSLIB_INCLUDE_DIR)
+#  WCSLIB_LIBRARY      - the Wcslib library (cached)
+#  WCSLIB_LIBRARIES    - the Wcslib libraries
+#                         (identical to WCSLIB_LIBRARY)
+
+if(NOT WCSLIB_FOUND)
+
+  find_path(WCSLIB_INCLUDE_DIR wcslib/wcs.h)
+  find_library(WCSLIB_LIBRARY wcs)
+  mark_as_advanced(WCSLIB_INCLUDE_DIR WCSLIB_LIBRARY)
+
+  include(FindPackageHandleStandardArgs)
+  set(custom_msg "Could NOT find Wcslib in ${CMAKE_PREFIX_PATH}")
+  find_package_handle_standard_args(Wcslib "${custom_msg}"
+    WCSLIB_LIBRARY WCSLIB_INCLUDE_DIR)
+
+  set(WCSLIB_INCLUDE_DIRS ${WCSLIB_INCLUDE_DIR})
+  set(WCSLIB_LIBRARIES ${WCSLIB_LIBRARY})
+
+endif(NOT WCSLIB_FOUND)
-- 
GitLab