# Copyright 2011-2021 Free Software Foundation, Inc.
#
# This file was generated by gr_modtool, a tool from the GNU Radio framework
# This file is a part of gr-soapy
#
# SPDX-License-Identifier: GPL-3.0-or-later
#

########################################################################
# Setup library
########################################################################
add_library(gnuradio-soapy
  block_impl.cc
  source_impl.cc
  sink_impl.cc
)

target_link_libraries(gnuradio-soapy PUBLIC
    gnuradio-runtime
    ${SoapySDR_LIBRARIES}
)

target_include_directories(gnuradio-soapy PUBLIC
    $<INSTALL_INTERFACE:include>
    $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/../include>
)

#Add Windows DLL resource file if using MSVC
if (MSVC)
    include(${CMAKE_SOURCE_DIR}/cmake/Modules/GrVersion.cmake)

    configure_file(
        ${CMAKE_CURRENT_SOURCE_DIR}/gnuradio-soapy.rc.in
        ${CMAKE_CURRENT_BINARY_DIR}/gnuradio-soapy.rc
    @ONLY)

    target_sources(gnuradio-soapy PRIVATE
        ${CMAKE_CURRENT_BINARY_DIR}/gnuradio-soapy.rc
    )
endif (MSVC)

if(BUILD_SHARED_LIBS)
  GR_LIBRARY_FOO(gnuradio-soapy SoapySDR)
endif()

if(ENABLE_TESTING)
  include(GrTest)

  # If your unit tests require special include paths, add them here
  #include_directories()
  # List all files that contain Boost.UTF unit tests here
  list(APPEND test_soapy_sources)

  # Anything we need to link to for the unit tests go here
  list(APPEND GR_TEST_TARGET_DEPS gnuradio-soapy ${Boost_LIBRARIES})

  if(NOT test_soapy_sources)
    MESSAGE(STATUS "No C++ unit tests... skipping")
    return()
  endif(NOT test_soapy_sources)

  foreach(qa_file ${test_soapy_sources})
    GR_ADD_CPP_TEST("soapy_${qa_file}"
        ${CMAKE_CURRENT_SOURCE_DIR}/${qa_file}
    )
  endforeach(qa_file)
endif()
