[CMake] How Do I make a Custom Rule.
Brad King
brad.king at kitware.com
Tue Oct 3 09:59:08 EDT 2006
Peter Kahn wrote:
> What is the right pattern to use in cmake to create a custom rule for
> converting a bunch of files?
>
>
> In make I can define a custome rule for file types.
> What is the right way to do this in cmake?
>
> I can create a macro, but I'm unsure how to properly connect it to a
> target. I can't seem to put it in a custom target.
Just list the output source files in a target:
http://www.cmake.org/Wiki/CMake_FAQ#How_can_I_generate_a_source_file_during_the_build.3F
In your code these lines:
# Convert
ADD_CUSTOM_COMMAND(
OUTPUT tmpFile
COMMAND transmogrify
ARGS ${TMP_MCFILE}
)
do not make sense because it creates an output called "tmpFile" over and
over again in that FOREACH loop. Each rule should have its own output,
and all outputs you want to generate should be listed in a target.
-Brad
More information about the CMake
mailing list