On Saturday 03 May 2008 19:41:02 Alin M Elena wrote: > Hi, > > Is there any way to add a dependency to install or preinstall targets? > > The idea is simple. I have a custom target that builds the documentation > from sources. > When I package or install I want to be sure that I have up-to-date > documentation. > > Alin Hi,
There were many discussions on this subject, but I don't remember final solution. I suppose, in your case it is better to add special target via ADD_CUSTOM_COMMAND, where OUTPUT is your documentation file(s), and MAIN_DEPENDENCY/DEPENDS are source files. Later you can install output file as usually. This is based on several points: 1) "install" ensures that everything is built by executing make all target. 2) ADD_CUSTOM_COMMAND while used properly sets correct dependencies between target file and it's sources, so if anything changed, CMake will rebuild this and all dependent targets. 3) INSTALL command will install generated target. Of course, this will not work with ADD_CUSTOM_TARGET. So the drawback is that your documentation will be built (if something has changed, that is actually only dependencies will be checked) every time you run make. I suppose in CMake this is handled by some kind of "BUILD_Documentation" variables to speed-up regular development. And if you need something really exotic at install time, you can refer to INSTALL(CODE/SCRIPT) commands :). Yuri _______________________________________________ CMake mailing list [email protected] http://www.cmake.org/mailman/listinfo/cmake
