The first problem is that in line 15 PATCH_COMMAND patch -p0 < ${CMAKE_SOURCE_DIR}/fix-unused-typedef-warning.patch the directory to find fix-unused-typedef-warning.patch is set to ${CMAKE_SOURCE_DIR}, which is ~/test_ws/src/ [in your case], but the file is in ~/catkin_ws/src/glog_catkin/ in your case]. So you should change ${CMAKE_SOURCE_DIR} to ${CMAKE_CURRENT_SOURCE_DIR}