consumer — the smallest project that links doppler¶
One source file, one find_package(doppler), two link modes. If you are
adding doppler to an existing build, start here: everything else in
example-projects/ is this plus a subject.
It runs the local oscillator at a quarter of the sample rate, where the output is known exactly (1, j, -1, -j, repeating), and exits 0 only if the samples match. It uses the pure-C core alone, so it is the same program on Linux, macOS and Windows. The oscillator is not the point — the link line is.
What it demonstrates¶
find_package(doppler)against an install prefix, which is how a downstream consumes a release rather than a source tree.- Both link targets.
doppler::doppleris the shared library;doppler::doppler-staticis the self-contained static one. Both binaries print the same thing, which is the point of building the pair — a difference between them is a packaging bug, not a program one. - Three build faces, all equivalent. CMake is below;
ccandpkg-configare in the next section, and CI asserts all three produce identical output (make consumer-faces-check).
Build and run¶
You need doppler installed somewhere CMake can find it. From a source tree:
Then:
Drop PREFIX= if doppler is installed system-wide. make help lists the
knobs; make clean removes build/.
The Makefile is a thin wrapper — the two commands it runs are:
Without CMake¶
The same program, compiled directly:
or letting pkg-config answer:
Copying it¶
Take CMakeLists.txt and the find_package block. main.c is a placeholder
for your program.