SET(LIB_NAME heautils_simput)

set(${LIB_NAME}_SOURCES
headas_copykeys.c headas_error.c
                      headas_error_init.c headas_error_manager.c headas_error_map.c
                      headas_history.c headas_toolname.c headas_utils.c
                      headas_parstamp.c headas_gti.c
                      HDgtcalf.c HDgtcalf_internal.c HDgtcalf_f77_wrap.c
                      headas_file_check.c headas_rand.c mt.c headas_lock.c
                      headas_polyfit.c headas_smooth.c headas_sort.c
                      headas_svdfit.c)

set(${LIB_NAME}_HEADERS
headas_copykeys.h headas_error.h
                headas_utils.h headas_gti.h hdcal.h headas_rand.h headas_lock.h
                hd_math_compat.h headas_polyfit.h HDgtcalf_internal.h
                HDgtcalf_standalone.h headas_error_cfitsio.h
                headas_error_internal.h mt.h)

add_library(${LIB_NAME} SHARED ${${LIB_NAME}_SOURCES} ${${LIB_NAME}_HEADERS})
set_target_properties(${LIB_NAME} PROPERTIES VERSION "1.0.0")
target_include_directories(${LIB_NAME} PUBLIC
        ${CMAKE_CURRENT_SOURCE_DIR}
        ${CMAKE_SOURCE_DIR}/extlib/cfitsio)
target_link_libraries(${LIB_NAME} PUBLIC
        compiler_flags
        ape_simput
        cfitsio_simput)

# INSTALL
set(installable_libs ${LIB_NAME})
install(TARGETS ${installable_libs})
install(FILES ${${LIB_NAME}_HEADERS} DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})
