set(PACKAGE base-user_lib)

message(STATUS ${PACKAGE})

set(LIB_NAME user-iris)
set(INST_INCLUDES user_lib.h nlscommon.h messages.h)

set(SOURCE_FILES
    messages.h
    nlscommon.h
    user_def.h
    user_lib.h
    angle.c
    AngleNames.c
    byteops.c
    c_cmd_lookup.c
    ClassifierNames.c
    compress.c
    DataConvert.c
    DataConvertClass.c
    DataNames.c
    data_types.c
    dft.c
    dspcustom.c
    EarthCurve.c
    error_report.c
    fambiguous_range.c
    fileops.c
    fnyquist_vel.c
    help.c
    KiloCount.c
    lowmath.c
    mapio.c
    message_support.c
    msgque.c
    process.c
    ProjectionNames.c
    rtvec.c
    schedule.c
    semaphore.c
    shmem.c
    sig_microSleepExact.c
    sig_subs.c
    sig_system.c
    SocketConnect.c
    SocketIo.c
    SocketSupport.c
    sphere.c
    str_subs.c
    swap.c
    TimeNames.c
    timesubs.c
    ttyio.c
    UdpSupport.c
    unlevelize.c
    user_lib_nls_init.c
    username.c
    VaxData.c
    window.c)

add_library(${LIB_NAME} SHARED ${SOURCE_FILES})

set(LIB_MAJOR_VER 10) # Set Library major version, this is also used for SO file versioning
set(LIB_MINOR_VER 0) # Set Library minor version
set(LIB_PATCH_VER 0) # Set Library patch version
set(LIB_VERSION "${LIB_MAJOR_VER}.${LIB_MINOR_VER}.${LIB_PATCH_VER}")
set_target_properties(${LIB_NAME} PROPERTIES VERSION ${LIB_VERSION} SOVERSION ${LIB_MAJOR_VER})

set_target_properties(${LIB_NAME} PROPERTIES COMPILE_FLAGS "-fPIC")

target_include_directories(
  ${LIB_NAME} PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}
                     ${CMAKE_CURRENT_SOURCE_DIR}/../misc_lib
                     ${CMAKE_CURRENT_SOURCE_DIR}/../himath_lib
                     ${CMAKE_CURRENT_SOURCE_DIR}/../include)

add_subdirectory(po)

install(
  TARGETS ${LIB_NAME}
  DESTINATION ${IRIS_LIB}
  LIBRARY COMPONENT libs NAMELINK_COMPONENT libs-devel)
install(
  FILES ${INST_INCLUDES}
  DESTINATION ${IRIS_INCLUDE}
  COMPONENT libs-devel)
