| 1 |
# - Try to find CFITSIO |
| 2 |
# Once done this will define |
| 3 |
# |
| 4 |
# CFITSIO_FOUND - system has CFITSIO |
| 5 |
# CFITSIO_INCLUDE_DIR - the CFITSIO include directory |
| 6 |
# CFITSIO_LIBRARIES - Link these to use CFITSIO |
| 7 |
# CFITSIO_VERSION_STRING - Human readable version number of cfitsio |
| 8 |
# CFITSIO_VERSION_MAJOR - Major version number of cfitsio |
| 9 |
# CFITSIO_VERSION_MINOR - Minor version number of cfitsio |
| 10 |
|
| 11 |
# Copyright (c) 2006, Jasem Mutlaq <[email protected]> |
| 12 |
# Based on FindLibfacile by Carsten Niehaus, <[email protected]> |
| 13 |
# |
| 14 |
# Redistribution and use is allowed according to the terms of the BSD license. |
| 15 |
# For details see the accompanying COPYING-CMAKE-SCRIPTS file. |
| 16 |
|
| 17 |
if (CFITSIO_INCLUDE_DIR AND CFITSIO_LIBRARIES) |
| 18 |
|
| 19 |
# in cache already |
| 20 |
set(CFITSIO_FOUND TRUE) |
| 21 |
message(STATUS "Found CFITSIO: ${CFITSIO_LIBRARIES}") |
| 22 |
|
| 23 |
|
| 24 |
else (CFITSIO_INCLUDE_DIR AND CFITSIO_LIBRARIES) |
| 25 |
|
| 26 |
# JM: Packages from different distributions have different suffixes |
| 27 |
find_path(CFITSIO_INCLUDE_DIR fitsio.h |
| 28 |
PATH_SUFFIXES libcfitsio3 libcfitsio0 cfitsio |
| 29 |
${_obIncDir} |
| 30 |
${GNUWIN32_DIR}/include |
| 31 |
) |
| 32 |
|
| 33 |
find_library(CFITSIO_LIBRARIES NAMES cfitsio |
| 34 |
PATHS |
| 35 |
${_obLinkDir} |
| 36 |
${GNUWIN32_DIR}/lib |
| 37 |
) |
| 38 |
|
| 39 |
if(CFITSIO_INCLUDE_DIR AND CFITSIO_LIBRARIES) |
| 40 |
set(CFITSIO_FOUND TRUE) |
| 41 |
else (CFITSIO_INCLUDE_DIR AND CFITSIO_LIBRARIES) |
| 42 |
set(CFITSIO_FOUND FALSE) |
| 43 |
endif(CFITSIO_INCLUDE_DIR AND CFITSIO_LIBRARIES) |
| 44 |
|
| 45 |
|
| 46 |
if (CFITSIO_FOUND) |
| 47 |
|
| 48 |
# Find the version of the cfitsio header |
| 49 |
file(STRINGS ${CFITSIO_INCLUDE_DIR}/fitsio.h CFITSIO_VERSION_STRING LIMIT_COUNT 1 REGEX "CFITSIO_VERSION") |
| 50 |
STRING(REGEX REPLACE "[^0-9.]" "" CFITSIO_VERSION_STRING ${CFITSIO_VERSION_STRING}) |
| 51 |
STRING(REGEX REPLACE "^([0-9]+)[.]([0-9]+)" "\\1" CFITSIO_VERSION_MAJOR ${CFITSIO_VERSION_STRING}) |
| 52 |
STRING(REGEX REPLACE "^([0-9]+)[.]([0-9]+)" "\\2" CFITSIO_VERSION_MINOR ${CFITSIO_VERSION_STRING}) |
| 53 |
|
| 54 |
if (NOT CFITSIO_FIND_QUIETLY) |
| 55 |
message(STATUS "Found CFITSIO ${CFITSIO_VERSION_STRING}: ${CFITSIO_LIBRARIES}") |
| 56 |
endif (NOT CFITSIO_FIND_QUIETLY) |
| 57 |
else (CFITSIO_FOUND) |
| 58 |
if (CFITSIO_FIND_REQUIRED) |
| 59 |
message(STATUS "CFITSIO not found.") |
| 60 |
endif (CFITSIO_FIND_REQUIRED) |
| 61 |
endif (CFITSIO_FOUND) |
| 62 |
|
| 63 |
mark_as_advanced(CFITSIO_INCLUDE_DIR CFITSIO_LIBRARIES) |
| 64 |
|
| 65 |
endif (CFITSIO_INCLUDE_DIR AND CFITSIO_LIBRARIES) |