I was so annoyed with Qt5widgets issues compiling with cmake. After fixing it couple of times, i am posting it for others.

$ cmake .
CMake Warning at src/CMakeLists.txt:6 (message):
The CULA environment variables are not defined.  RAN and RBF networks will
not be build.

CMake Error at src/apps/CMakeLists.txt:22 (find_package):
By not providing “FindQt5Widgets.cmake” in CMAKE_MODULE_PATH this project
has asked CMake to find a package configuration file provided by
“Qt5Widgets”, but CMake did not find one.

Could not find a package configuration file provided by “Qt5Widgets” with
any of the following names:

Qt5WidgetsConfig.cmake
qt5widgets-config.cmake

Add the installation prefix of “Qt5Widgets” to CMAKE_PREFIX_PATH or set
“Qt5Widgets_DIR” to a directory containing one of the above files.  If
“Qt5Widgets” provides a separate development package or SDK, be sure it has
been installed.

— Configuring incomplete, errors occurred!
See also “/Users/prabhubalakrishnan/Desktop/gpumlib/CMakeFiles/CMakeOutput.log”.

Fix

brew install qt5

search the qt5 path files of brew

locate qt5 (or) brew info qt5

and finally compile with the -D flag giving the path

$ cmake . -DCMAKE_PREFIX_PATH=/usr/local/Cellar/qt5/5.3.2