[CMake] newbie question - what targets are supported?

Michael Hertling mhertling at online.de
Thu May 27 22:16:31 EDT 2010


On 05/28/2010 12:14 AM, Doug Reiland wrote:
> okay, I have ordered the book. But, in the meantime.
> 
> I am continuing to port a large library from in-house build to cmake
> for evaluation.
> What builtin targets are supported?

On *nix, run CMake on a directory with an empty CMakeLists.txt, then
invoke "make help" and you'll see the targets provided a priori - or
did you rather mean "rules" instead of "targets"?

> I got lex, gperf, and other kinds of stuff.
> 
> A (pseudo code) didn't work:
> add_library(foo *.c *.gpref)

ADD_LIBRARY() et al. process source files for languages known to CMake,
primarily C and C++, but other files may be specified for dependency
tracking. To process a gperf input file, e.g., use a custom command:

ADD_CUSTOM_COMMAND(
    OUTPUT xyz.c
    COMMAND gperf xyz.gperf > xyz.c
    DEPENDS xyz.gperf
)

The OUTPUT file can be specified in ADD_LIBRARY(foo ... xyz.c ...),
which results in the custom command being run when xyz.c is needed for
foo, but out of date. For lex and other input not intimately known to
CMake, the procedure is usually quite the same. If you have many such
files to process consider to write a function for automatization:

<http://www.cmake.org/pipermail/cmake/2010-May/036955.html>

Regards,

Michael


More information about the CMake mailing list