[CMake] adding files to a custom target

Timenkov Yuri ytimenkov at gmail.com
Wed Sep 24 10:48:35 EDT 2008


Use add_custom_command to compile your files. This one accepts source and
destination file names for proper dependency handling.
Next, use add_custom_target command with dependencies on add_custom_target's
output.
For example:
add_custom_command(OUTPUT myscript.compiled
 COMMAND compile_script myscript.src
 DEPENDS myscript.src)
add_custom_target(BuildScripts DEPENDS myscript.compiled VERBATIM)

Something like this. See documentation for both commands. Of course, you can
use single custom target for all your scripts, and you can write macro to
wrap script's sources with add_custom_command.


On Tue, Sep 23, 2008 at 1:43 AM, Jesse Corrington <
jesse.corrington at gmail.com> wrote:

> I'm trying to create a custom target for compiling scripts in MSVC, but I
> can't seem to find anyway to add the files to the project when using
> ADD_CUSTOM_TARGET. I just want to be able to add files to a custom target
> project and then specify a post build step to compile the scripts with our
> internal script compiler. The current hack I have in place is to use
> ADD_EXECUTABLE and just use a dummy cpp file with an empty main. I figure
> there must be a better way than this.
>
> _______________________________________________
> CMake mailing list
> CMake at cmake.org
> http://www.cmake.org/mailman/listinfo/cmake
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20080924/8cc6c503/attachment.htm>


More information about the CMake mailing list