| 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 |
# Redistribution and use is allowed according to the terms of the BSD license. |
| 12 |
|
| 13 |
find_path(CFITSIO_INCLUDE_DIR fitsio.h |
| 14 |
PATH_SUFFIXES libcfitsio3 libcfitsio0 cfitsio |
| 15 |
PATHS |
| 16 |
$ENV{CFITSIO} |
| 17 |
${_obIncDir} |
| 18 |
${GNUWIN32_DIR}/include |
| 19 |
/opt/local/include |
| 20 |
) |
| 21 |
|
| 22 |
find_library(CFITSIO_LIBRARIES NAMES cfitsio |
| 23 |
PATHS |
| 24 |
$ENV{CFITSIO} |
| 25 |
${_obLinkDir} |
| 26 |
${GNUWIN32_DIR}/lib |
| 27 |
/opt/local/lib |
| 28 |
) |
| 29 |
|
| 30 |
if(CFITSIO_INCLUDE_DIR AND CFITSIO_LIBRARIES) |
| 31 |
# Find the version of the cfitsio header |
| 32 |
FILE(READ "${CFITSIO_INCLUDE_DIR}/fitsio.h" FITSIO_H) |
| 33 |
STRING(REGEX REPLACE ".*#define CFITSIO_VERSION[^0-9]*([0-9]+)\\.([0-9]+).*" "\\1.\\2" CFITSIO_VERSION_STRING "${FITSIO_H}") |
| 34 |
STRING(REGEX REPLACE "^([0-9]+)[.]([0-9]+)" "\\1" CFITSIO_VERSION_MAJOR ${CFITSIO_VERSION_STRING}) |
| 35 |
STRING(REGEX REPLACE "^([0-9]+)[.]([0-9]+)" "\\2" CFITSIO_VERSION_MINOR ${CFITSIO_VERSION_STRING}) |
| 36 |
|
| 37 |
SET(CFITSIO_VERSION_STRING "${CFITSIO_VERSION_MAJOR}.${CFITSIO_VERSION_MINOR}") |
| 38 |
endif() |
| 39 |
|
| 40 |
include(FindPackageHandleStandardArgs) |
| 41 |
|
| 42 |
find_package_handle_standard_args(CFITSIO |
| 43 |
REQUIRED_VARS CFITSIO_LIBRARIES CFITSIO_INCLUDE_DIR CFITSIO_VERSION_STRING) |
| 44 |
mark_as_advanced(CFITSIO_INCLUDE_DIR CFITSIO_LIBRARIES) |