Undefined Symbol SDL_RenderGeometry() SDL2-2.0.22

I have downloaded the most recent source, SDL2-2.0.22.
I compile it on Ubuntu 20.04 with CMake.
I can see the symbol SDL_RenderGeometry in the produced shared object file with objump -t.
I can compile a sample program that calls SDL_RenderGeometry.
However, when I run this sample program I get undefined symbol: SDL_RenderGeometry
Why is this?
Are there certain libraries I need to installed prior to compiling for this to work?
Thanks

Originally, may SDL2 related compiler flags were: -I$HOME/prog/sources/SDL2-2.0.22/include -L$HOME/prog/sources/SDL2-2.0.22/build

Inspecting the output of sdl-config I added -Wl,-rpath,$HOME/prog/sources/SDL2-2.0.22/build -Wl,--enable-new-dtags and it now works.
Can someone explain why this is?

It’s using the systems SDL during runtime not the one you compiled.

SDL_RenderGeometry was added in SDL 2.0.18. I’m guessing your system uses a version older than 2.0.18.

ldd a.out will show the full path to the shared object that a.out is linked to. Try doing it with both the problematic and fixed program.

The dynamic linker only looks at the default paths (probably /lib and /usr/lib) for finding the shared objects. Additional paths can be specified using RPATH in the binaries or setting LD_LIBRARY_PATH environment variable.

rpath on wikipedia

-Wl,option on stackoverflow

-rpath and -L difference on stackoverflow

why -rpath and -L on stackoverflow

Yes, it seems it was the pesky rpath. Thank you