How can I "Set OPENCV_ENABLE_NONFREE CMake option and rebuild the library in function 'create'"?

I built opencv_contrib and some of the modules are working, however when I'm trying to use SURF I get: "error: (-213:The function/feature is not implemented) This algorithm is patented and is excluded in this configuration; Set OPENCV_ENABLE_NONFREE CMake option and rebuild the library in function 'create'".
So how can I enable nonfree?