David, Thanks for your help. So if I do it as you suggest, this will also require I specify `ALL` to add_custom_target(), correct? If I do it this way, will it still run even if it isn't a dependency of the target I'm building?
Let me set up a simple scenario for my own understanding. Suppose I have the following targets: * A (add_library target) * B (add_library target) * C (add_custom_target target) Dependencies: B depends on A C depends on B and A Normally if I build B, only A and B will build. However, if C was set up using `ALL`, will it build C when I build B? So the expected build order in this case would be: 1. A 2. B 3. C Thanks in advance. On Wed, May 17, 2017 at 4:26 PM, David Cole <dlrd...@aol.com> wrote: > The way I know how to do this is to add it last at the bottom of the > top-level CMakeLists.txt file, and then use add_dependencies to make > it depend on all other targets. (Or at least all other "leaf" targets, > which further depend on others, ... the sum of which is "all other > targets" besides the new "last" target.) > > So it's not pretty, but it's possible. > > > HTH, > David C. > > > > On Wed, May 17, 2017 at 11:36 AM, Robert Dailey > <rcdailey.li...@gmail.com> wrote: >> I have a custom target that must meet the following requirements: >> >> * It must always run, regardless of what subset of other targets are being >> built >> * It must always be the very last thing run. In parallelized builds, >> it must wait until all other targets are done building before >> starting, so that it is the very last target run, and should not run >> in parallel with others. >> >> Is this possible? I'm willing to use hackery if needed... >> >> Running CMake 3.8.0. Thanks! >> -- >> >> Powered by www.kitware.com >> >> Please keep messages on-topic and check the CMake FAQ at: >> http://www.cmake.org/Wiki/CMake_FAQ >> >> Kitware offers various services to support the CMake community. For more >> information on each offering, please visit: >> >> CMake Support: http://cmake.org/cmake/help/support.html >> CMake Consulting: http://cmake.org/cmake/help/consulting.html >> CMake Training Courses: http://cmake.org/cmake/help/training.html >> >> Visit other Kitware open-source projects at >> http://www.kitware.com/opensource/opensource.html >> >> Follow this link to subscribe/unsubscribe: >> http://public.kitware.com/mailman/listinfo/cmake -- Powered by www.kitware.com Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Kitware offers various services to support the CMake community. For more information on each offering, please visit: CMake Support: http://cmake.org/cmake/help/support.html CMake Consulting: http://cmake.org/cmake/help/consulting.html CMake Training Courses: http://cmake.org/cmake/help/training.html Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Follow this link to subscribe/unsubscribe: http://public.kitware.com/mailman/listinfo/cmake