File: FindCFitsio.cmake

package info (click to toggle)
labplot 2.12.1-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 78,500 kB
  • sloc: cpp: 241,048; ansic: 6,324; python: 915; xml: 400; yacc: 237; sh: 221; awk: 35; makefile: 11
file content (59 lines) | stat: -rw-r--r-- 1,819 bytes parent folder | download | duplicates (2)
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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
# - 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

# SPDX-FileCopyrightText: 2006 Jasem Mutlaq <mutlaqja@ikarustech.com>
# Based on FindLibfacile by Carsten Niehaus, <cniehaus@gmx.de>
#
# SPDX-License-Identifier: BSD-3-Clause

if (NOT WIN32)
    find_package(PkgConfig QUIET)
    if (PKG_CONFIG_FOUND)
        pkg_check_modules(PC_CFITSIO cfitsio QUIET)
        set(CFITSIO_VERSION ${PC_CFITSIO_VERSION})
    endif ()
endif ()

if (CFITSIO_INCLUDE_DIR AND CFITSIO_LIBRARIES)
    # Already in cache
    set(CFITSIO_FOUND TRUE)
    message(STATUS "Found CFITSIO: ${CFITSIO_LIBRARIES}, ${CFITSIO_INCLUDE_DIR} (found version \"${CFITSIO_VERSION}\")")
else ()
    find_path(CFITSIO_INCLUDE_DIR fitsio.h
            ${PC_CFITSIO_INCLUDE_DIRS}
            ${_obIncDir}
            ${GNUWIN32_DIR}/include
    )

    find_library(CFITSIO_LIBRARIES NAMES cfitsio libcfitsio QUIET
            PATHS
            ${PC_CFITSIO_LIBRARY_DIRS}
            ${_obIncDir}
            ${GNUWIN32_DIR}/include
    )

    if(CFITSIO_INCLUDE_DIR AND CFITSIO_LIBRARIES)
        set(CFITSIO_FOUND TRUE)
    else ()
        set(CFITSIO_FOUND FALSE)
    endif()

    if (CFITSIO_FOUND)
        if (NOT CFitsio_FIND_QUIETLY)
		message(STATUS "Found CFITSIO: ${CFITSIO_LIBRARIES}, ${CFITSIO_INCLUDE_DIR} (found version \"${CFITSIO_VERSION}\")")
        endif (NOT CFitsio_FIND_QUIETLY)
    else ()
        if (CFitsio_FIND_REQUIRED)
            message(FATAL_ERROR "CFITSIO not found. Please install libcfitsio-dev or cfitsio-devel and try again.")
        endif ()
        set(CFITSIO_LIBRARIES "")
    endif ()


    mark_as_advanced(CFITSIO_INCLUDE_DIR CFITSIO_LIBRARIES CFITSIO_VERSION)

endif ()