MariaDB uses hardcoded path for searching libexecinfo library (needed for backtrace() function) in cmake/os/FreeBSD.cmake:
INCLUDE_DIRECTORIES(/usr/local/include)
SET(CMAKE_REQUIRED_INCLUDES ${CMAKE_REQUIRED_INCLUDES} /usr/local/include )
SET(ENV
{LIB} "$ENV{LIB}
:/usr/local/lib")
FIND_LIBRARY(EXECINFO NAMES execinfo)
IF(EXECINFO)
SET(LIBEXECINFO ${EXECINFO})
ENDIF()
The problem is that despite the fact that "/usr/local" is default for LOCALBASE in FreeBSD, it could be changed and should be supported by port, which I maintain.
My proposition is to add EXECINFO_ROOT, which will default to "/usr/local", but could be overridden with -DEXECINFO_ROOT during configure stage.