Is there any way within a CMakeLists.txt file to get a list of all the currently defined targets? I'm interested in this for two primary reasons, and if anyone can point me to other solutions for these that would be great, but I'm sort of stumped.
1) I have a timestamp rule that prints out the time at the start of the build. Ideally, I'd like this target to depend on every other target in the project, so it is always run at the beginning of the project, but manually specifying dependencies for something like that is an un-maintainable nightmare. I'd vastly prefer to (as the last step in the CMakeLists.txt file) iterate over all targets and make each of them depend on the timestamp rule. Unfortunately, so far I can't figure out how to do this. 2) I've been asked to implement a clean rule that removes JUST the final product of a target (exe file, lib, etc) and not the individual compiled files that are finally linked to form the product. If there is a feature like this in CMake I haven't found it yet, and the only way I can think to do this globally (as opposed to adding extra logic to every single target manually or via wrapper macro) is again to iterate over a target list, (hopefully) read the product info from the target properties, and generate a rule based on that. Does anyone know of a solution to this sort of custom clean behavior? Cheers, and thanks! CY _______________________________________________ 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