Hi all,
I want to work with simple gnuradio objects in a C++ IDE (e.g. Qtcreator)
using CMake build system.
I am running ubuntu 22.04 and gnuradio 3.10.11.0.
How can I write its cmakelists.txt?

For example, to just test these PMT lines:

 #include <pmt/pmt.h> // [...] pmt::pmt_t P = pmt::from_long(23);
std::cout << P << std::endl; pmt::pmt_t P2 = pmt::from_complex(0,1);
std::cout << P2 << std::endl; std::cout << pmt::is_complex(P2) <<
std::endl;

I add the following lines to its cmakelists.tx

# Find GNU Radio package, specifying required components
find_package(Gnuradio "3.10" REQUIRED COMPONENTS pmt)  # Adjust the
version and components as needed

# Check if GNU Radio is found
if(Gnuradio_FOUND)
    message(STATUS "GNU Radio found.")
    message(STATUS "GNU Radio include dirs: ${Gnuradio_INCLUDE_DIRS}")
    message(STATUS "GNU Radio libraries: ${Gnuradio_LIBRARIES}")
else()
    message(FATAL_ERROR "GNU Radio not found!")
endif()

# Include directories for your project
include_directories(
    ${Gnuradio_INCLUDE_DIRS}  # GNU Radio include directories
    ${CMAKE_SOURCE_DIR}/include  # Your custom include directories
)

# Define the executable
add_executable(myproject ${SOURCES})

# Link the executable with GNU Radio libraries
target_link_libraries(myproject ${GNURADIO_LIBRARIES})

but it doesn't work.

I'd be grateful if someone help me write working cmakelists.txt.

Thanks!

Reply via email to