cmake: actually make linking work

Appending to lists from subdirs does not work as expected, so work
around that to allow collecting the necessary libs.
gr3.8
Eric Wild 2 years ago
parent 5cf6f4df96
commit dadabeceaf
  1. 14
      lib/CMakeLists.txt
  2. 2
      lib/airspy/CMakeLists.txt
  3. 2
      lib/airspyhf/CMakeLists.txt
  4. 2
      lib/bladerf/CMakeLists.txt
  5. 2
      lib/fcd/CMakeLists.txt
  6. 2
      lib/file/CMakeLists.txt
  7. 2
      lib/freesrp/CMakeLists.txt
  8. 2
      lib/hackrf/CMakeLists.txt
  9. 2
      lib/miri/CMakeLists.txt
  10. 2
      lib/osmosdr/CMakeLists.txt
  11. 2
      lib/redpitaya/CMakeLists.txt
  12. 2
      lib/rtl/CMakeLists.txt
  13. 2
      lib/rtl_tcp/CMakeLists.txt
  14. 2
      lib/sdrplay/CMakeLists.txt
  15. 2
      lib/soapy/CMakeLists.txt
  16. 2
      lib/uhd/CMakeLists.txt

@ -40,8 +40,16 @@ if(CMAKE_COMPILER_IS_GNUCXX)
list(APPEND Boost_LIBRARIES -pthread)
endif()
#dirty macro to allow appending from subdirs
#this appends all unnamed implicit macro args!
MACRO (APPEND_LIB_LIST)
SET (gr_osmosdr_libs "${gr_osmosdr_libs};${ARGN}" CACHE INTERNAL "lib list")
ENDMACRO (APPEND_INTERNAL_LIST)
set(gr_osmosdr_libs "" CACHE INTERNAL "lib that accumulates link targets")
add_library(gnuradio-osmosdr SHARED)
list(APPEND gr_osmosdr_libs ${Boost_LIBRARIES} gnuradio::gnuradio-runtime)
APPEND_LIB_LIST(${Boost_LIBRARIES} gnuradio::gnuradio-runtime)
target_include_directories(gnuradio-osmosdr
PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}
PUBLIC ${Boost_INCLUDE_DIRS}
@ -100,7 +108,7 @@ CHECK_CXX_SOURCE_COMPILES("
if(HAVE_CLOCK_GETTIME)
message(STATUS " High resolution timing supported through clock_gettime.")
set(TIME_SPEC_DEFS HAVE_CLOCK_GETTIME)
list(APPEND gr_osmosdr_libs "-lrt")
APPEND_LIB_LIST( "-lrt")
elseif(HAVE_MACH_ABSOLUTE_TIME)
message(STATUS " High resolution timing supported through mach_absolute_time.")
set(TIME_SPEC_DEFS HAVE_MACH_ABSOLUTE_TIME)
@ -124,7 +132,7 @@ GR_REGISTER_COMPONENT("Osmocom IQ Imbalance Correction" ENABLE_IQBALANCE gnuradi
if(ENABLE_IQBALANCE)
add_definitions(-DHAVE_IQBALANCE=1)
target_include_directories(gnuradio-osmosdr PRIVATE ${gnuradio-iqbalance_INCLUDE_DIRS})
list(APPEND gr_osmosdr_libs gnuradio::gnuradio-iqbalance)
APPEND_LIB_LIST( gnuradio::gnuradio-iqbalance)
endif(ENABLE_IQBALANCE)
########################################################################

@ -26,7 +26,7 @@ target_include_directories(gnuradio-osmosdr PRIVATE
${LIBAIRSPY_INCLUDE_DIRS}
)
list(APPEND gr_osmosdr_libs
APPEND_LIB_LIST(
gnuradio::gnuradio-filter
${Gnuradio-blocks_LIBRARIES}
${LIBAIRSPY_LIBRARIES}

@ -26,7 +26,7 @@ target_include_directories(gnuradio-osmosdr PRIVATE
${LIBAIRSPYHF_INCLUDE_DIRS}
)
list(APPEND gr_osmosdr_libs
APPEND_LIB_LIST(
${Gnuradio-blocks_LIBRARIES}
${LIBAIRSPYHF_LIBRARIES}
)

@ -27,7 +27,7 @@ target_include_directories(gnuradio-osmosdr PRIVATE
${Volk_INCLUDE_DIRS}
)
list(APPEND gr_osmosdr_libs
APPEND_LIB_LIST(
${LIBBLADERF_LIBRARIES}
${Volk_LIBRARIES}
)

@ -26,7 +26,7 @@ target_include_directories(gnuradio-osmosdr PRIVATE
${GNURADIO_FCDPP_INCLUDE_DIRS}
)
list(APPEND gr_osmosdr_libs
APPEND_LIB_LIST(
${GNURADIO_FCDPP_LIBRARIES}
)

@ -25,7 +25,7 @@ target_include_directories(gnuradio-osmosdr PRIVATE
${CMAKE_CURRENT_SOURCE_DIR}
)
list(APPEND gr_osmosdr_libs
APPEND_LIB_LIST(
gnuradio::gnuradio-blocks
)
message(STATUS ${gnuradio-blocks_LIBRARIES})

@ -26,7 +26,7 @@ target_include_directories(gnuradio-osmosdr PRIVATE
${LIBFREESRP_INCLUDE_DIRS}
)
list(APPEND gr_osmosdr_libs
APPEND_LIB_LIST(
${LIBFREESRP_LIBRARIES}
)

@ -26,7 +26,7 @@ target_include_directories(gnuradio-osmosdr PRIVATE
${LIBHACKRF_INCLUDE_DIRS}
)
list(APPEND gr_osmosdr_libs
APPEND_LIB_LIST(
${LIBHACKRF_LIBRARIES}
)

@ -26,7 +26,7 @@ target_include_directories(gnuradio-osmosdr PRIVATE
${LIBMIRISDR_INCLUDE_DIRS}
)
list(APPEND gr_osmosdr_libs
APPEND_LIB_LIST(
${LIBMIRISDR_LIBRARIES}
)

@ -26,7 +26,7 @@ target_include_directories(gnuradio-osmosdr PRIVATE
${LIBOSMOSDR_INCLUDE_DIRS}
)
list(APPEND gr_osmosdr_libs
APPEND_LIB_LIST(
${LIBOSMOSDR_LIBRARIES}
)

@ -25,7 +25,7 @@ target_include_directories(gnuradio-osmosdr PRIVATE
${CMAKE_CURRENT_SOURCE_DIR}
)
list(APPEND gr_osmosdr_libs
APPEND_LIB_LIST(
${Gnuradio-blocks_LIBRARIES}
)

@ -26,7 +26,7 @@ target_include_directories(gnuradio-osmosdr PRIVATE
${LIBRTLSDR_INCLUDE_DIRS}
)
list(APPEND gr_osmosdr_libs
APPEND_LIB_LIST(
${LIBRTLSDR_LIBRARIES}
)

@ -25,7 +25,7 @@ target_include_directories(gnuradio-osmosdr PRIVATE
${CMAKE_CURRENT_SOURCE_DIR}
)
list(APPEND gr_osmosdr_libs
APPEND_LIB_LIST(
${Gnuradio-blocks_LIBRARIES}
)

@ -26,7 +26,7 @@ target_include_directories(gnuradio-osmosdr PRIVATE
${LIBSDRPLAY_INCLUDE_DIRS}
)
list(APPEND gr_osmosdr_libs
APPEND_LIB_LIST(
${LIBSDRPLAY_LIBRARIES}
)

@ -26,7 +26,7 @@ target_include_directories(gnuradio-osmosdr PRIVATE
${SoapySDR_INCLUDE_DIRS}
)
list(APPEND gr_osmosdr_libs
APPEND_LIB_LIST(
${SoapySDR_LIBRARIES}
)

@ -27,7 +27,7 @@ target_include_directories(gnuradio-osmosdr PRIVATE
${UHD_INCLUDE_DIRS}
)
list(APPEND gr_osmosdr_libs
APPEND_LIB_LIST(
gnuradio::gnuradio-uhd
${UHD_LIBRARIES}
)

Loading…
Cancel
Save