Never mind, I found an easy solution. I just added my fake ".target" file as a second output of the command, and use "cmake -E touch" to update the .target timestamp whenever my custom command executes. Even though the timestamp of my "true" output isn't being updated, CMake doesn't re-execute the command.
David On Mon, May 31, 2010 at 10:13 AM, David Gobbi <[email protected]> wrote: > Hi all, > > There are times when a CMake custom command will generate exactly the > same output file even if its inputs have changed. In these cases, I > would like the timestamp on the output file to remain unchanged, but > to generate a fake ".target" file with the current timestamp so the > custom command will not be re-execute the next time I run CMake. > > Here is an example: > > I've written a tool called vtkBuildHeirarchy that goes through the VTK > header files and writes a text file that describes the class > hierarchy. Then, I have some special wrappers that use this text file > to do compile-time type introspection. > > A naive approach would force a complete re-build of the wrappers if > even a single header file has changed. However, the only important > changes to the wrapper are those that change the actual hierarchy. > > So, I have made my vtkBuildHeirarchy executable so that it pre-reads > the output and then only overwrites it if the hierarchy has changed. > This keeps my wrappers from re-compiling when they don't have to. > However, now the vtkBuildHeirarchy executable runs every time > (actually several times) when I run cmake because its output file's > timestamp is not updated. > > This is why I want to create a second, "fake" output file with a > .target extension, so that vtkBuildHeirarchy won't execute if this > "target" file is more recent than its inputs. However, commands that > depend on vtkBuildHeirachy's output will have to continue to check the > timestamp of the "real" output file. > > Is there a way of splitting a target into a real target/fake target in cmake? > > David > _______________________________________________ Powered by www.kitware.com Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Follow this link to subscribe/unsubscribe: http://www.cmake.org/mailman/listinfo/cmake
