1# ***************************************************************************
2# *                                                                         *
3# *   Copyright : (C) 2010 The University of Toronto                        *
4# *   email     : netterfield@astro.utoronto.ca                             *
5# *                                                                         *
6# *   Copyright : (C) 2010 Peter Kümmel                                     *
7# *   email     : syntheticpp@gmx.net                                       *
8# *                                                                         *
9# *   This program is free software; you can redistribute it and/or modify  *
10# *   it under the terms of the GNU General Public License as published by  *
11# *   the Free Software Foundation; either version 2 of the License, or     *
12# *   (at your option) any later version.                                   *
13# *                                                                         *
14# ***************************************************************************
15
16if(NOT CFITSIO_INCLUDEDIR)
17
18if(NOT kst_cross)
19	include(FindPkgConfig)
20	pkg_check_modules(cfitsio QUIET cfitsio)
21endif()
22
23if(CFITSIO_INCLUDEDIR AND CFITSIO_LIBRARIES)
24	set(CFITSIO_LIBRARY -L${CFITSIO_LIBRARY_DIRS} ${CFITSIO_LIBRARIES})
25else()
26	set(CFITSIO_INCLUDEDIR CFITSIO_INCLUDEDIR-NOTFOUND CACHE STRING "" FORCE)
27	FIND_PATH(CFITSIO_INCLUDEDIR fitsio.h
28		HINTS
29		ENV CFITSIO_DIR
30		PATH_SUFFIXES include include/cfitsio include/libcfitsio0
31		PATHS ${kst_3rdparty_dir}
32		)
33	FIND_LIBRARY(CFITSIO_LIBRARIES cfitsio
34		HINTS
35		ENV CFITSIO_DIR
36		PATH_SUFFIXES lib
37		PATHS ${kst_3rdparty_dir}
38		)
39endif()
40endif()
41
42#message(STATUS "CFITSIO: ${CFITSIO_INCLUDEDIR}")
43#message(STATUS "CFITSIO: ${CFITSIO_LIBRARIES}")
44IF(CFITSIO_INCLUDEDIR AND CFITSIO_LIBRARIES)
45	SET(CFITSIO_INCLUDE_DIR ${CFITSIO_INCLUDEDIR} ${CFITSIO_INCLUDEDIR}/..)
46	if (UNIX)
47		SET(CFITSIO_LIBRARIES ${CFITSIO_LIBRARIES} m)
48	endif()
49	SET(CFITSIO 1)
50	SET(cfitsio 1)
51	message(STATUS "Found CFITSIO:")
52	message(STATUS "     includes : ${CFITSIO_INCLUDE_DIR}")
53	message(STATUS "     libraries: ${CFITSIO_LIBRARIES}")
54ELSE()
55	MESSAGE(STATUS "Not found: CFITSIO, set CFITSIO_DIR")
56ENDIF()
57message(STATUS "")
58
59
60