[CMake] add_custom_command as target
Cmake provides add_custom_target, but that creates a target that gets run either always (ALL) or manually by running make target. Cmake also provides an add_custom_command that tracks file dependencies and gets run when a dependency changes. However, add_custom_command assumes the files are always intermediate files (ie. not targets) and for the command to actually appear in the Makefile, the output of the command has to have been added to add_executable or similar. Is there a way to create an add_custom_target that tracks dependencies? Or an add_custom_command that will act as a target (without needlessly being added to add_executable, etc). Basically, I'm trying to have a macro that compiles NVidia's .cg files to profile shaders and as such the shaders are targets that depend on the cg files. -- Gonzalo Garramuño [EMAIL PROTECTED] AMD4400 - ASUS48N-E GeForce7300GT Xubuntu Gutsy ___ CMake mailing list CMake@cmake.org http://www.cmake.org/mailman/listinfo/cmake
Re: [CMake] add_custom_command as target
On Jan 17, 2008 5:10 AM, Gonzalo Garramuño [EMAIL PROTECTED] wrote: Is there a way to create an add_custom_target that tracks dependencies? Or an add_custom_command that will act as a target (without needlessly being added to add_executable, etc). To get the effect of that, you wrap your add_custom_command with an add_custom_target. add_custom_command(OUTPUT blah ...) add_custom_target(mytarget DEPENDS blah ...) Admittedly this is inelegant, but it works. I have no idea how much work it would be to remove the distinction between file level and target level dependencies. Cheers, Brandon Van Every ___ CMake mailing list CMake@cmake.org http://www.cmake.org/mailman/listinfo/cmake
Re: [CMake] add_custom_command as target
Brandon Van Every wrote: Admittedly this is inelegant, but it works. I have no idea how much work it would be to remove the distinction between file level and target level dependencies. It isn't inelegant, but quite logical. It probably should be kept as is, as it allows easily adding multiple dependencies to a single target. I thought of trying that as a last resort but by then I had more or less given up. That feature is, however, undocumented. Neither of the add_custom_* nor the wiki has any mention of this or the possibility of add_custom_target being able to take a custom command. -- Gonzalo Garramuño [EMAIL PROTECTED] AMD4400 - ASUS48N-E GeForce7300GT Xubuntu Gutsy ___ CMake mailing list CMake@cmake.org http://www.cmake.org/mailman/listinfo/cmake
Re: [CMake] add_custom_command as target
On Jan 17, 2008 7:46 AM, Gonzalo Garramuño [EMAIL PROTECTED] wrote: That feature is, however, undocumented. Neither of the add_custom_* nor the wiki has any mention of this or the possibility of add_custom_target being able to take a custom command. Not true. add_custom_target says, Dependencies listed with the DEPENDS argument may reference files and outputs of custom commands created with ADD_CUSTOM_COMMAND. Cheers, Brandon Van Every ___ CMake mailing list CMake@cmake.org http://www.cmake.org/mailman/listinfo/cmake