set(SOURCE_FILES
        timeval_ops.h
        config_set.h
        i16stream.h
        nav_system.h
        radar_ray.h
        radar_sweep.h
        radar_scan.h
        rawprod_io.h
        rscan_prod_io.h
        archive2_io.h
        nav_system.c
        config_set.c
        radar_ray.c
        radar_sweep.c
        radar_scan.c
        i16stream.c
        rawprod_io.c
        rscan_prod_io.c
        archive2_io.c)

add_library(rscan SHARED ${SOURCE_FILES})

target_include_directories(rscan PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}
        ${CMAKE_CURRENT_SOURCE_DIR}/../dsp_lib
        ${CMAKE_CURRENT_SOURCE_DIR}/../user_lib
        ${CMAKE_CURRENT_SOURCE_DIR}/../include)

# TODO: rscan should not require "user dsp antenna config exthdr dl z" libs
# The antenna, z, and config are pulled in by dsp
link_libraries(rscan user dsp antenna config exthdr dl z m popt)

add_executable(test_rawprodio test_rawprodio.c)
add_executable(test_i16stream test_i16stream.c)
add_executable(test_config_set config_set.c)
add_executable(test_convert test_convert.c)
add_executable(remove_sweep remove_sweep.c)

set_target_properties(test_config_set PROPERTIES COMPILE_FLAGS "-DCONFIG_SET_UNITTEST")
set_target_properties(test_rawprodio PROPERTIES COMPILE_FLAGS "-DNO_NETCDF")
