Fixes #18816
This PR enables functional tests to be included in the ctest suite when the ENABLE_FUNCTIONAL_TESTS flag is set to ON during the CMake configuration.
i.e
cmake -B build -DENABLE_FUNCTIONAL_TESTS=ON
cmake --build build
ctest --test-dir build