How to switch between llvm version in Almalinux

Almalinux 9 provides llvm version 19.
I need to build a software that requires llvm15 so I deploy llvm15 and clang15 rpm from epel.
But is there a way to switch properly from version 19 to version 15 ? I’ve used update-alternatives for clang and clang++ but there are so many tools in /usr/lib64/llvm15/bin and just modifying the PATH is not enought as some cmake strategies looks first in /usr/bin where clang19 is installed.

I did use dnf --enablerepo=epel rq -l llvm15 to list files in that EPEL package (without installing it).
It seems that it provides files of pattern /usr/bin/*-15, e.g. /usr/bin/lli-15 which presumably corresponds to the /usr/bin/lli of the LLVM 19 (but calls the /usr/lib64/llvm15/bin/lli).

The dnf --enablerepo=epel rq -l llvm15\* | grep -i cmake lists also some config files for CMake. Could CMake find the *-15 paths with that config?

Yes, exactly — CMake can use those config files from the llvm15 package.
Just point CMake to the right directory and use the versioned compilers:
cmake -S . -B build
-DCMAKE_C_COMPILER=clang-15
-DCMAKE_CXX_COMPILER=clang+±15
-DLLVM_DIR=/usr/lib64/llvm15/lib64/cmake/llvm
-DClang_DIR=/usr/lib64/llvm15/lib64/cmake/clang
This way find_package(LLVM CONFIG) and find_package(Clang CONFIG) will resolve to the v15 configs provided by EPEL, instead of the system LLVM 19.