cmake_minimum_required(VERSION 3.1)
project(atFunctions C)

find_package(PkgConfig)

# atFunctions
file(GLOB atFunctions_sources "src/*.c")
ADD_LIBRARY(atFunctions SHARED ${atFunctions_sources})
set_target_properties(atFunctions PROPERTIES LINKER_LANGUAGE C)


set(CFITSIO_BASE /opt/homebrew)
set(CFITSIO_INCDIR ${CFITSIO_BASE}/include)
set(CFITSIO_LIBDIR ${CFITSIO_BASE}/lib)
message(CFITSIO_INCDIR ${CFITSIO_INCDIR})
message(CFITSIO_LIBDIR ${CFITSIO_LIBDIR})


target_include_directories(atFunctions PUBLIC ${CMAKE_SOURCE_DIR}/include ${CFITSIO_INCDIR} )


set(CMAKE_C_FLAGS "-g")
set(CMAKE_C_COMPILER gcc)
set(CMAKE_VERBOSE_MAKEFILE 1)
target_link_libraries(atFunctions ${CFITSIO_LIBDIR}/libcfitsio.dylib)

message(STATUS ${atFunctions})

INSTALL(TARGETS atFunctions LIBRARY DESTINATION lib)

#
file(GLOB atFunctions_includes "include/*.h")
INSTALL(FILES ${atFunctions_includes} DESTINATION include PERMISSIONS OWNER_WRITE OWNER_READ OWNER_EXECUTE)

