On Thu, May 07, 2009 at 04:57:11PM +0200, Piotr Wyderski wrote: > And specify a command to generate the file: > > ADD_CUSTOM_COMMAND( > > OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/inc.cpp > COMMAND YYY >inc.cpp > DEPENDS ${_runtime_header_list} > ) > > but what shoud YYY be in order to achieve the following goal: > > 1. all the entries from _runtime_header_list are enumerated > and a single temporary file t1.cpp is created as follows: > > #include "entry_1" > #include "entry_2" > ... > #include "entry_n" > > 2. t1 is sent to the C++ compiler (with all its options, > definitions and include paths set as for a normal build), > but for preprocessing stage only (i.e. g++ -E). The resulting > C++ file is my inc.cpp.
I would probably use my favorite scripting language to generate the file. You could probably use foreach() and file(WRITE ...) if you want a pure CMake solution. I don't know how to run the preprocessor by itself. If all you are trying to do is write out a file containing the contents of entry_1 ... entry_n, I wouldn't bother with the preprocessor; I would use a scripting language or cat or file(READ ...) combined with file(WRITE ...). hth, tyler _______________________________________________ Powered by www.kitware.com Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Follow this link to subscribe/unsubscribe: http://www.cmake.org/mailman/listinfo/cmake