cmake: Go back CMake min ver. 3.8 by removing need for CMP0079

CMake 3.13 is not present in older (~2 years old)
Linux distributions and GNU Radio requires min CMake
version 3.8.

All that is needed in order to avoid bumping CMake version
is to not use 'target_link_libraries' in subdirectories.
Here this is done by creating a list of needed
libraries and adding them for linking at the end (like
it was done in gr-osmosdr before porting to GNU Radio 3.8).

One thing that is lost here is 'PRIVATE' statement in case
of FCD libraries linking.

Signed-off-by: Eric Wild <ewild@sysmocom.de>
gr3.8
Piotr Krysik 3 years ago committed by Eric Wild
parent af2fda22b3
commit 8cf6840da1
  1. 3
      CMakeLists.txt
  2. 7
      lib/CMakeLists.txt
  3. 2
      lib/airspy/CMakeLists.txt
  4. 2
      lib/airspyhf/CMakeLists.txt
  5. 2
      lib/bladerf/CMakeLists.txt
  6. 5
      lib/fcd/CMakeLists.txt
  7. 2
      lib/file/CMakeLists.txt
  8. 2
      lib/freesrp/CMakeLists.txt
  9. 2
      lib/hackrf/CMakeLists.txt
  10. 2
      lib/miri/CMakeLists.txt
  11. 2
      lib/osmosdr/CMakeLists.txt
  12. 2
      lib/redpitaya/CMakeLists.txt
  13. 2
      lib/rtl/CMakeLists.txt
  14. 2
      lib/rtl_tcp/CMakeLists.txt
  15. 2
      lib/sdrplay/CMakeLists.txt
  16. 2
      lib/soapy/CMakeLists.txt
  17. 2
      lib/uhd/CMakeLists.txt

@ -20,14 +20,13 @@
########################################################################
# Project setup
########################################################################
cmake_minimum_required(VERSION 3.13)
cmake_minimum_required(VERSION 3.8)
include(GNUInstallDirs)
project(gr-osmosdr CXX C)
enable_testing()
#policy setup
cmake_policy(SET CMP0011 NEW)
cmake_policy(SET CMP0079 NEW)
#select the release build type by default to get optimization flags
if(NOT CMAKE_BUILD_TYPE)

@ -41,7 +41,7 @@ if(CMAKE_COMPILER_IS_GNUCXX)
endif()
add_library(gnuradio-osmosdr SHARED)
target_link_libraries(gnuradio-osmosdr ${Boost_LIBRARIES} gnuradio::gnuradio-runtime)
list(APPEND gr_osmosdr_libs ${Boost_LIBRARIES} gnuradio::gnuradio-runtime)
target_include_directories(gnuradio-osmosdr
PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}
PUBLIC ${Boost_INCLUDE_DIRS}
@ -100,7 +100,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)
target_link_libraries(gnuradio-osmosdr "-lrt")
list(APPEND gr_osmosdr_libs "-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 +124,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})
target_link_libraries(gnuradio-osmosdr gnuradio::gnuradio-iqbalance)
list(APPEND gr_osmosdr_libs gnuradio::gnuradio-iqbalance)
endif(ENABLE_IQBALANCE)
########################################################################
@ -263,6 +263,7 @@ configure_file(
# Finalize target
########################################################################
set_target_properties(gnuradio-osmosdr PROPERTIES SOURCES "${gr_osmosdr_srcs}")
target_link_libraries(gnuradio-osmosdr ${gr_osmosdr_libs})
########################################################################
# Install built library files

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

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

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

@ -29,7 +29,8 @@ if(ENABLE_FCD)
target_include_directories(gnuradio-osmosdr PRIVATE
${Gnuradio-fcd_INCLUDE_DIRS}
)
target_link_libraries(gnuradio-osmosdr PRIVATE
list(APPEND gr_osmosdr_libs
${Gnuradio-fcd_LIBRARIES}
)
endif(ENABLE_FCD)
@ -38,7 +39,7 @@ if(ENABLE_FCDPP)
target_include_directories(gnuradio-osmosdr PRIVATE
${Gnuradio-fcdpp_INCLUDE_DIRS}
)
target_link_libraries(gnuradio-osmosdr PRIVATE
list(APPEND gr_osmosdr_libs
${Gnuradio-fcdpp_LIBRARIES}
)
endif(ENABLE_FCDPP)

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

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

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

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

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

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

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

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

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

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

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

Loading…
Cancel
Save