Done! Big Thanks!
I just connected a "Signal Source" to a "Null Sink" in GRC, changed the
Option's "Output Language" to C++,
pushed "Generate" (F5), took a look at the generated CMakeLists.txt, and
found the answer.

Thanks!

On Thu, Aug 1, 2024 at 10:15 PM Marcus Müller <mmuel...@gnuradio.org> wrote:

> Hi Ali,
>
> since CMake is the default build system we use both for our OOT templates
> (as used by
> gr_modtool) and by the C++ code generated throug GRC, I'd say:
>
> just use the existing work as template.
>
> What you're doing here is mixing modern CMake, i.e. a config/target-based
> method of
> defining the compiler and linker properties of your compilation units,
> with manual
> "include_directories" things. Probably not a great idea! If you compare
> that with what
> `gr_modtool` generates in its lib/CMakeLists.txt, you'll find how we'd, as
> a project,
> would recommend you do it.
>
> Best,
> Marcus
>
> On 01.08.24 11:17, Ali G. Dezfuli wrote:
> > 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_tP=pmt::from_long(23);std::cout<<P<<std::endl;pmt::pmt_tP2=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