Fix possible configuration error in CMakeLists.txt

This error would manifest if BUILD_DOCS was not set to ON