[SDL_image] Can't specify path to SDL3 from cmake CLI [Solved]

As the title suggest, I can’t find a way to override SDL3 path when building SDL_image from cmake CLI. I tried to add -DSDL3_DIR=my/path/to/SDL3/cmakelists but I wasn’t successfull. I suppose that there is something I don’t understand about the way cmake find_package works.

Building SDL3_image needs an already-built SDL3 library and SDL3 headers.
SDL3_image’s CMake script finds those by calling find_package(SDL3 ...).

CMake should then look for SDL3Config.cmake using this search procedure.

In your case, assuming you built SDL3 in /my/path/to/SDL3/build, you can pass -DCMAKE_PREFIX_PATH=/my/path/to/SDL3/build.

SDL3_DIR is the directory containing SDL3Config.cmake.
Make sure to clear it because it will block find_package finding SDL3!
Do this by configuring with -USDL3_DIR.

It worked thank you !