forked from sdr/gr-osmosdr
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.
This commit is contained in:
parent
5cf6f4df96
commit
dadabeceaf
|
@ -40,8 +40,16 @@ if(CMAKE_COMPILER_IS_GNUCXX)
|
||||||
list(APPEND Boost_LIBRARIES -pthread)
|
list(APPEND Boost_LIBRARIES -pthread)
|
||||||
endif()
|
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)
|
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
|
target_include_directories(gnuradio-osmosdr
|
||||||
PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}
|
PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}
|
||||||
PUBLIC ${Boost_INCLUDE_DIRS}
|
PUBLIC ${Boost_INCLUDE_DIRS}
|
||||||
|
@ -100,7 +108,7 @@ CHECK_CXX_SOURCE_COMPILES("
|
||||||
if(HAVE_CLOCK_GETTIME)
|
if(HAVE_CLOCK_GETTIME)
|
||||||
message(STATUS " High resolution timing supported through clock_gettime.")
|
message(STATUS " High resolution timing supported through clock_gettime.")
|
||||||
set(TIME_SPEC_DEFS HAVE_CLOCK_GETTIME)
|
set(TIME_SPEC_DEFS HAVE_CLOCK_GETTIME)
|
||||||
list(APPEND gr_osmosdr_libs "-lrt")
|
APPEND_LIB_LIST( "-lrt")
|
||||||
elseif(HAVE_MACH_ABSOLUTE_TIME)
|
elseif(HAVE_MACH_ABSOLUTE_TIME)
|
||||||
message(STATUS " High resolution timing supported through mach_absolute_time.")
|
message(STATUS " High resolution timing supported through mach_absolute_time.")
|
||||||
set(TIME_SPEC_DEFS HAVE_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)
|
if(ENABLE_IQBALANCE)
|
||||||
add_definitions(-DHAVE_IQBALANCE=1)
|
add_definitions(-DHAVE_IQBALANCE=1)
|
||||||
target_include_directories(gnuradio-osmosdr PRIVATE ${gnuradio-iqbalance_INCLUDE_DIRS})
|
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)
|
endif(ENABLE_IQBALANCE)
|
||||||
|
|
||||||
########################################################################
|
########################################################################
|
||||||
|
|
|
@ -26,7 +26,7 @@ target_include_directories(gnuradio-osmosdr PRIVATE
|
||||||
${LIBAIRSPY_INCLUDE_DIRS}
|
${LIBAIRSPY_INCLUDE_DIRS}
|
||||||
)
|
)
|
||||||
|
|
||||||
list(APPEND gr_osmosdr_libs
|
APPEND_LIB_LIST(
|
||||||
gnuradio::gnuradio-filter
|
gnuradio::gnuradio-filter
|
||||||
${Gnuradio-blocks_LIBRARIES}
|
${Gnuradio-blocks_LIBRARIES}
|
||||||
${LIBAIRSPY_LIBRARIES}
|
${LIBAIRSPY_LIBRARIES}
|
||||||
|
|
|
@ -26,7 +26,7 @@ target_include_directories(gnuradio-osmosdr PRIVATE
|
||||||
${LIBAIRSPYHF_INCLUDE_DIRS}
|
${LIBAIRSPYHF_INCLUDE_DIRS}
|
||||||
)
|
)
|
||||||
|
|
||||||
list(APPEND gr_osmosdr_libs
|
APPEND_LIB_LIST(
|
||||||
${Gnuradio-blocks_LIBRARIES}
|
${Gnuradio-blocks_LIBRARIES}
|
||||||
${LIBAIRSPYHF_LIBRARIES}
|
${LIBAIRSPYHF_LIBRARIES}
|
||||||
)
|
)
|
||||||
|
|
|
@ -27,7 +27,7 @@ target_include_directories(gnuradio-osmosdr PRIVATE
|
||||||
${Volk_INCLUDE_DIRS}
|
${Volk_INCLUDE_DIRS}
|
||||||
)
|
)
|
||||||
|
|
||||||
list(APPEND gr_osmosdr_libs
|
APPEND_LIB_LIST(
|
||||||
${LIBBLADERF_LIBRARIES}
|
${LIBBLADERF_LIBRARIES}
|
||||||
${Volk_LIBRARIES}
|
${Volk_LIBRARIES}
|
||||||
)
|
)
|
||||||
|
|
|
@ -26,7 +26,7 @@ target_include_directories(gnuradio-osmosdr PRIVATE
|
||||||
${GNURADIO_FCDPP_INCLUDE_DIRS}
|
${GNURADIO_FCDPP_INCLUDE_DIRS}
|
||||||
)
|
)
|
||||||
|
|
||||||
list(APPEND gr_osmosdr_libs
|
APPEND_LIB_LIST(
|
||||||
${GNURADIO_FCDPP_LIBRARIES}
|
${GNURADIO_FCDPP_LIBRARIES}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
@ -25,7 +25,7 @@ target_include_directories(gnuradio-osmosdr PRIVATE
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}
|
${CMAKE_CURRENT_SOURCE_DIR}
|
||||||
)
|
)
|
||||||
|
|
||||||
list(APPEND gr_osmosdr_libs
|
APPEND_LIB_LIST(
|
||||||
gnuradio::gnuradio-blocks
|
gnuradio::gnuradio-blocks
|
||||||
)
|
)
|
||||||
message(STATUS ${gnuradio-blocks_LIBRARIES})
|
message(STATUS ${gnuradio-blocks_LIBRARIES})
|
||||||
|
|
|
@ -26,7 +26,7 @@ target_include_directories(gnuradio-osmosdr PRIVATE
|
||||||
${LIBFREESRP_INCLUDE_DIRS}
|
${LIBFREESRP_INCLUDE_DIRS}
|
||||||
)
|
)
|
||||||
|
|
||||||
list(APPEND gr_osmosdr_libs
|
APPEND_LIB_LIST(
|
||||||
${LIBFREESRP_LIBRARIES}
|
${LIBFREESRP_LIBRARIES}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
@ -26,7 +26,7 @@ target_include_directories(gnuradio-osmosdr PRIVATE
|
||||||
${LIBHACKRF_INCLUDE_DIRS}
|
${LIBHACKRF_INCLUDE_DIRS}
|
||||||
)
|
)
|
||||||
|
|
||||||
list(APPEND gr_osmosdr_libs
|
APPEND_LIB_LIST(
|
||||||
${LIBHACKRF_LIBRARIES}
|
${LIBHACKRF_LIBRARIES}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
@ -26,7 +26,7 @@ target_include_directories(gnuradio-osmosdr PRIVATE
|
||||||
${LIBMIRISDR_INCLUDE_DIRS}
|
${LIBMIRISDR_INCLUDE_DIRS}
|
||||||
)
|
)
|
||||||
|
|
||||||
list(APPEND gr_osmosdr_libs
|
APPEND_LIB_LIST(
|
||||||
${LIBMIRISDR_LIBRARIES}
|
${LIBMIRISDR_LIBRARIES}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
@ -26,7 +26,7 @@ target_include_directories(gnuradio-osmosdr PRIVATE
|
||||||
${LIBOSMOSDR_INCLUDE_DIRS}
|
${LIBOSMOSDR_INCLUDE_DIRS}
|
||||||
)
|
)
|
||||||
|
|
||||||
list(APPEND gr_osmosdr_libs
|
APPEND_LIB_LIST(
|
||||||
${LIBOSMOSDR_LIBRARIES}
|
${LIBOSMOSDR_LIBRARIES}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
@ -25,7 +25,7 @@ target_include_directories(gnuradio-osmosdr PRIVATE
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}
|
${CMAKE_CURRENT_SOURCE_DIR}
|
||||||
)
|
)
|
||||||
|
|
||||||
list(APPEND gr_osmosdr_libs
|
APPEND_LIB_LIST(
|
||||||
${Gnuradio-blocks_LIBRARIES}
|
${Gnuradio-blocks_LIBRARIES}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
@ -26,7 +26,7 @@ target_include_directories(gnuradio-osmosdr PRIVATE
|
||||||
${LIBRTLSDR_INCLUDE_DIRS}
|
${LIBRTLSDR_INCLUDE_DIRS}
|
||||||
)
|
)
|
||||||
|
|
||||||
list(APPEND gr_osmosdr_libs
|
APPEND_LIB_LIST(
|
||||||
${LIBRTLSDR_LIBRARIES}
|
${LIBRTLSDR_LIBRARIES}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
@ -25,7 +25,7 @@ target_include_directories(gnuradio-osmosdr PRIVATE
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}
|
${CMAKE_CURRENT_SOURCE_DIR}
|
||||||
)
|
)
|
||||||
|
|
||||||
list(APPEND gr_osmosdr_libs
|
APPEND_LIB_LIST(
|
||||||
${Gnuradio-blocks_LIBRARIES}
|
${Gnuradio-blocks_LIBRARIES}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
@ -26,7 +26,7 @@ target_include_directories(gnuradio-osmosdr PRIVATE
|
||||||
${LIBSDRPLAY_INCLUDE_DIRS}
|
${LIBSDRPLAY_INCLUDE_DIRS}
|
||||||
)
|
)
|
||||||
|
|
||||||
list(APPEND gr_osmosdr_libs
|
APPEND_LIB_LIST(
|
||||||
${LIBSDRPLAY_LIBRARIES}
|
${LIBSDRPLAY_LIBRARIES}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
@ -26,7 +26,7 @@ target_include_directories(gnuradio-osmosdr PRIVATE
|
||||||
${SoapySDR_INCLUDE_DIRS}
|
${SoapySDR_INCLUDE_DIRS}
|
||||||
)
|
)
|
||||||
|
|
||||||
list(APPEND gr_osmosdr_libs
|
APPEND_LIB_LIST(
|
||||||
${SoapySDR_LIBRARIES}
|
${SoapySDR_LIBRARIES}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
@ -27,7 +27,7 @@ target_include_directories(gnuradio-osmosdr PRIVATE
|
||||||
${UHD_INCLUDE_DIRS}
|
${UHD_INCLUDE_DIRS}
|
||||||
)
|
)
|
||||||
|
|
||||||
list(APPEND gr_osmosdr_libs
|
APPEND_LIB_LIST(
|
||||||
gnuradio::gnuradio-uhd
|
gnuradio::gnuradio-uhd
|
||||||
${UHD_LIBRARIES}
|
${UHD_LIBRARIES}
|
||||||
)
|
)
|
||||||
|
|
Loading…
Reference in New Issue