"unrecognized argument to ‘-flto=’ option" error

I am currently trying to install a project on my Linux machine. My CMake version is 3.22.1. When I type ‘make’ command I am getting this error:

unrecognized argument to ‘-flto=’ option: ‘auto -ffat-lto-objects -flto=auto’

I found out these two lines in the CMakeCache.txt file:

//MPI C compilation options
MPI_C_COMPILE_OPTIONS:STRING=-flto=auto;-ffat-lto-objects;-flto=auto

I don’t think that there exists any problem with the installation of MPI. And when i comment out these two lines I am getting so many errors containing messages like this:

undefined reference to 'ompi_mpi_*'

Any kind of help is appreciated. Thanks for your time.