Either compile letting CMake automatically find your system lensfun installation, or specify a custom one using LENSFUNDBDIR as described here: http://rawpedia.rawtherapee.com/Linux#CMake
Should you need to use a Lensfun database in a custom location, you can point RawTherapee to it by editing the options file and setting the DBDirectory key’s value to the absolute path of the custom Lensfun database file.
Fedora 31, with distro lensfun-0.3.2-22.fc31 package.
RT built under mock, no customisations.
Seems OK, Nikon D7500 is not listed, older bodies are listed, lens correction works.
-- Checking for module 'lensfun>=0.2'
-- Found lensfun, version 0.3.2.0
-- Performing Test LENSFUN_HAS_LOAD_DIRECTORY
-- Performing Test LENSFUN_HAS_LOAD_DIRECTORY - Success