[CMake] How Do I make a Custom Rule.
Peter Kahn
citizenkahn at gmail.com
Tue Oct 3 15:29:15 EDT 2006
Thanks.
If I have a two or three step process as in the automap example which is the
better idiom:
- I have one custom command do each of the steps.
- I wrap the steps a script kept in a centralized place and have the custom
command call it.
Example: automake:
.xml.h:
cat base.xml $< > $.hprep
transmogrify $*.hprep
build/tools/transmogrify.py
import os
os.system('cat %s %s.xml > %s.hprep' % (sys.argv[0], sys.argv[1], sys.argv
[1]))
os.system('transmogrify %s.hprep' % sys.argv[1])
# Convert
ADD_CUSTOM_COMMAND(
OUTPUT tmpFile
COMMAND ${TOOLSDIR}/transmogrify.py
ARGS ${BASEFILE_PATH} ${TMP_MCFILE_NAME}
)
On 10/3/06, Brad King <brad.king at kitware.com> wrote:
>
> 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
>
--
Peter Kahn
citizenkahn at gmail.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://public.kitware.com/pipermail/cmake/attachments/20061003/d6d9263b/attachment.htm
More information about the CMake
mailing list