[CMake] Build rule for specific file extension

Mathias Lafeldt misfire at debugon.org
Fri Jun 25 07:26:16 EDT 2010


is there a way to tell CMake how to "compile" files based on their

For example, here's a make rule to build an object file from a *.lst file:

%.o : %.lst
    echo "#include \"irx_imports.h\"" > build-imports.c
    cat $< >> build-imports.c
    $(IOP_CC) $(IOP_CFLAGS) build-imports.c -o $@
    -rm -f build-imports.c

How can I convert this to CMake? I considered using add_custom_target,
but I don't know how to apply it to all files with the same extension.


More information about the CMake mailing list