[CMake] out-of-source build and generated files

Scott Amort jsamort at gmail.com
Thu Jun 29 22:38:13 EDT 2006


Hi,

First off, thanks to the CMake developers and responders on this list,
my transition to CMake has been almost completely painless, and best of
all, very fast!

I have one more question, however.  Now that my newly-CMaked project
works, I've been experimenting with out-of-source builds.  I have run
into a problem relating to generated files.  My library makes use of an
ANTLR generated lexer/parser, and as it is still quite new and
developing, I include the ANTLR grammar files and generate the source
files at build time with an ADD_CUSTOM_COMMAND.  Works great.  Except,
with an out-of-source build, these newly generated files populate the
source directory, which is what I was trying to avoid with the
out-of-source build.  Has anyone else encountered this situation?  I'm
not really sure how to solve it - if I alter the ADD_CUSTOM_COMMAND to
generate the files in the build directory, they aren't where the
compiler expects them to be, and I can't list them in the CMake
ADD_LIBRARY command as being in the build directory as they don't exist
there yet.  Any thoughts?

Hope this makes sense,
Scott


More information about the CMake mailing list