[x265] [PATCH] cmake: add a clean-generated Makefile rule

Steve Borho steve at borho.org
Fri May 2 00:41:55 CEST 2014


# HG changeset patch
# User Steve Borho <steve at borho.org>
# Date 1398984102 18000
#      Thu May 01 17:41:42 2014 -0500
# Node ID 022f24345d35879b20f89841e11004bdfe6bb27d
# Parent  8d7a2abc7c002f5aced27c2efe88786945d960b0
cmake: add a clean-generated Makefile rule

'make clean-generated' will remove all the machine generated files in the build
folder so that they will be re-generated with more up-to-date version info the
next time you run 'make'

The "easy" workaround for this problem is to just nuke the build folder and
start a new one.

diff -r 8d7a2abc7c00 -r 022f24345d35 source/CMakeLists.txt
--- a/source/CMakeLists.txt	Thu May 01 15:58:19 2014 -0500
+++ b/source/CMakeLists.txt	Thu May 01 17:41:42 2014 -0500
@@ -250,6 +250,10 @@
     configure_file("${CMAKE_CURRENT_SOURCE_DIR}/x265.rc.in" "${X265_RC_FILE}" @ONLY)
 endif()
 
+if(NOT (MSVC_IDE OR XCODE))
+    add_custom_target(clean-generated COMMAND ${CMAKE_COMMAND} -P ${CMAKE_CURRENT_SOURCE_DIR}/cmake/clean-generated.cmake)
+endif()
+
 option(ENABLE_SHARED "Build shared library" ON)
 if(ENABLE_SHARED)
     add_library(x265-shared SHARED "${PROJECT_BINARY_DIR}/x265.def" ${YASM_OBJS}
diff -r 8d7a2abc7c00 -r 022f24345d35 source/cmake/clean-generated.cmake
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/source/cmake/clean-generated.cmake	Thu May 01 17:41:42 2014 -0500
@@ -0,0 +1,9 @@
+set(generated "${CMAKE_CURRENT_BINARY_DIR}/x265.rc"
+              "${CMAKE_CURRENT_BINARY_DIR}/x265.pc"
+              "${CMAKE_CURRENT_BINARY_DIR}/x265_config.h")
+
+foreach(file ${generated})
+  if(EXISTS ${file})
+     file(REMOVE ${file})
+  endif()
+endforeach(file)


More information about the x265-devel mailing list