[CMake] Question about ADD_CUSTOM_COMMAND
David Cole
david.cole at kitware.com
Tue Aug 30 09:26:59 EDT 2005
This is addressed in section 7.4 of the "Mastering CMake" book (p. 90).
The recommended technique is to set up a variable that has the list of
*.dot files in it and then use a FOREACH construct to do an
ADD_CUSTOM_COMMAND for each *.dot file...
You could use FILE(GLOB_RECURSE DOT_LIST "*.dot") to get a list of the
*.dot files under the directory being processed. Or you could explicitly
specify all of the *.dot files in a list in your CMakeLists.txt file.
Something like this:
FILE(GLOB_RECURSE DOT_LIST "*.dot")
FOREACH(DOT_FILE ${DOT_LIST})
...
ENDFOREACH(DOT_FILE)
HTH,
David
Gary Kramlich wrote:
>I'm in the process of porting an application from static Makefiles to
>cmake to make building easier on other platforms. However, I have quite a
>bit of documentation and graphs that are created by dot. I see that I can
>find dot by using ${CMAKE_ROOT}/Modules/FindDoxygen.make, and I have this
>done. My question however is, is there any way to create a custom
>target/command that will work with wild cards? For exmaple, I had the
>below in my static makefile:
>
>%.png: %.dot
> dot -T $(FORMAT) -o $@ $<
>
>Needless to say, this is very helpful, and I would prefer to avoid having
>to manually add a command for each graph.
>
>
>
More information about the CMake
mailing list