[Piglit] [PATCH v3 14/19] cmake: Make each *.o depend on generated piglit_dispatch headers

Paul Berry stereotype441 at gmail.com
Wed Mar 21 08:58:13 PDT 2012


From: Chad Versace <chad.versace at linux.intel.com>

Alter the wrapper functions `piglit_add_executable` and
`piglit_add_library` to add to each object file a dependency on
piglit_dispatch's generated files. This requires that a top-level custom
target be created, `piglit_dispatch_gen`, to track that dependency.

The result is that updating any files in `piglit_dispatch_gen_inputs` (for
example, gl_API.xml) triggers a recompile of all objects.

Signed-off-by: Chad Versace <chad.versace at linux.intel.com>
---
 cmake/piglit_util.cmake |   18 ++++++++++++------
 1 files changed, 12 insertions(+), 6 deletions(-)

diff --git a/cmake/piglit_util.cmake b/cmake/piglit_util.cmake
index 68c7288..0daaad2 100644
--- a/cmake/piglit_util.cmake
+++ b/cmake/piglit_util.cmake
@@ -49,27 +49,33 @@ function(piglit_include_target_api)
 endfunction(piglit_include_target_api)
 
 #
-# For now, this is a trivial wrapper around `add_executable`.
+# function piglit_add_executable
 #
-# In the future, it will be used to add to each object file an explicit
-# dependency on the header files generated by piglit_dispatch.
+# This function wraps `add_executable` and has the same signature.
+#
+# In addition to calling `add_executable`, it adds to each object file
+# a dependency on piglit_dispatch's generated files.
 #
 function(piglit_add_executable name)
 
     list(REMOVE_AT ARGV 0)
     add_executable(${name} ${ARGV})
+    add_dependencies(${name} piglit_dispatch_gen)
 
 endfunction(piglit_add_executable)
 
 #
-# For now, this is a trivial wrapper around `add_library`.
+# function piglit_add_library
+#
+# This function wraps `add_library` and has the same signature.
 #
-# In the future, it will be used to add to each object file an explicit
-# dependency on the header files generated by piglit_dispatch.
+# In addition to calling `add_library`, it adds to each object file
+# a dependency on piglit_dispatch's generated files.
 #
 function(piglit_add_library name)
 
     list(REMOVE_AT ARGV 0)
     add_library(${name} ${ARGV})
+    add_dependencies(${name} piglit_dispatch_gen)
 
 endfunction(piglit_add_library)
-- 
1.7.7.6



More information about the Piglit mailing list