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

Alexander Neundorf a.neundorf-work at gmx.net
Fri Jun 30 02:31:42 EDT 2006


-------- Original-Nachricht --------
Datum: Thu, 29 Jun 2006 22:38:13 -0400
Von: Scott Amort <jsamort at gmail.com>
An: CMake at cmake.org
Betreff: [CMake] out-of-source build and generated files

> 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?

If you generate files using ADD_CUSTOM_COMMAND(), you should always use full paths for the generated files, i.e. ${CMAKE_CURRENT_BINARY_DIR}/generatedsource.cpp , both in the ADD_CUSTOM_COMMAND() and in the list of source files.

Bye
Alex

-- 


"Feel free" – 10 GB Mailbox, 100 FreeSMS/Monat ...
Jetzt GMX TopMail testen: http://www.gmx.net/de/go/topmail


More information about the CMake mailing list