File: FindCFITSIO.cmake

package info (click to toggle)
luminance-hdr 2.6.0%2Bdfsg-2
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 34,700 kB
  • sloc: cpp: 43,912; ansic: 4,122; xml: 116; makefile: 20; sh: 7
file content (44 lines) | stat: -rw-r--r-- 1,589 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
# - Try to find CFITSIO
# Once done this will define
#
#  CFITSIO_FOUND - system has CFITSIO
#  CFITSIO_INCLUDE_DIR - the CFITSIO include directory
#  CFITSIO_LIBRARIES - Link these to use CFITSIO
#  CFITSIO_VERSION_STRING - Human readable version number of cfitsio
#  CFITSIO_VERSION_MAJOR  - Major version number of cfitsio
#  CFITSIO_VERSION_MINOR  - Minor version number of cfitsio
#
# Redistribution and use is allowed according to the terms of the BSD license.

find_path(CFITSIO_INCLUDE_DIR fitsio.h
    PATH_SUFFIXES libcfitsio3 libcfitsio0 cfitsio
    PATHS
    $ENV{CFITSIO}
    ${_obIncDir}
    ${GNUWIN32_DIR}/include
    /opt/local/include
)

find_library(CFITSIO_LIBRARIES NAMES cfitsio
    PATHS
    $ENV{CFITSIO}
    ${_obLinkDir}
    ${GNUWIN32_DIR}/lib
    /opt/local/lib
)

if(CFITSIO_INCLUDE_DIR AND CFITSIO_LIBRARIES)
    # Find the version of the cfitsio header
    FILE(READ "${CFITSIO_INCLUDE_DIR}/fitsio.h" FITSIO_H)
    STRING(REGEX REPLACE ".*#define CFITSIO_VERSION[^0-9]*([0-9]+)\\.([0-9]+).*" "\\1.\\2" CFITSIO_VERSION_STRING "${FITSIO_H}")
    STRING(REGEX REPLACE "^([0-9]+)[.]([0-9]+)" "\\1" CFITSIO_VERSION_MAJOR ${CFITSIO_VERSION_STRING})
    STRING(REGEX REPLACE "^([0-9]+)[.]([0-9]+)" "\\2" CFITSIO_VERSION_MINOR ${CFITSIO_VERSION_STRING})

    SET(CFITSIO_VERSION_STRING "${CFITSIO_VERSION_MAJOR}.${CFITSIO_VERSION_MINOR}")
endif()

include(FindPackageHandleStandardArgs)

find_package_handle_standard_args(CFITSIO
    REQUIRED_VARS CFITSIO_LIBRARIES CFITSIO_INCLUDE_DIR CFITSIO_VERSION_STRING)
mark_as_advanced(CFITSIO_INCLUDE_DIR CFITSIO_LIBRARIES)