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 <mutlaqja@ikarustech.com>
|
---|
12 | # Based on FindLibfacile by Carsten Niehaus, <cniehaus@gmx.de>
|
---|
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 | execute_process(COMMAND egrep CFITSIO_VERSION ${CFITSIO_INCLUDE_DIR}/fitsio.h
|
---|
50 | OUTPUT_VARIABLE CFITSIO_VERSION_STRING)
|
---|
51 | STRING(REGEX REPLACE "[^0-9.]" "" CFITSIO_VERSION_STRING ${CFITSIO_VERSION_STRING})
|
---|
52 | STRING(REGEX REPLACE "^([0-9]+)[.]([0-9]+)" "\\1" CFITSIO_VERSION_MAJOR ${CFITSIO_VERSION_STRING})
|
---|
53 | STRING(REGEX REPLACE "^([0-9]+)[.]([0-9]+)" "\\2" CFITSIO_VERSION_MINOR ${CFITSIO_VERSION_STRING})
|
---|
54 |
|
---|
55 | if (NOT CFITSIO_FIND_QUIETLY)
|
---|
56 | message(STATUS "Found CFITSIO ${CFITSIO_VERSION_STRING}: ${CFITSIO_LIBRARIES}")
|
---|
57 | endif (NOT CFITSIO_FIND_QUIETLY)
|
---|
58 | else (CFITSIO_FOUND)
|
---|
59 | if (CFITSIO_FIND_REQUIRED)
|
---|
60 | message(STATUS "CFITSIO not found.")
|
---|
61 | endif (CFITSIO_FIND_REQUIRED)
|
---|
62 | endif (CFITSIO_FOUND)
|
---|
63 |
|
---|
64 | mark_as_advanced(CFITSIO_INCLUDE_DIR CFITSIO_LIBRARIES)
|
---|
65 |
|
---|
66 | endif (CFITSIO_INCLUDE_DIR AND CFITSIO_LIBRARIES)
|
---|