[CMake] Generated files?
Chris Johnson
cxjohnson at gmail.com
Thu Jan 29 10:09:26 EST 2015
I am looking for suggestions on how to solve the following problem. I
need a solution which is easy to understand and safe from future
maintenance errors.
There is a project directory with one C++ program and a large number of
"input" data files.
The C++ program needs to be compiled, and then run against each of the
input files to generate an output file of the same base name but with a
different output suffix. E.g. from the command line it might be:
% myprog file001.in file001.out
Finally, the output files need to be installed in the proper location.
For one input file, it might look like this:
add_executable(myprog myprog.cpp)
add_custom_command(OUTPUT file001.out
COMMAND /bin/cp ${CMAKE_CURRENT_SOURCE_DIR}/file001.in .
COMMAND myprog file001.in file001.out
DEPENDS files001.in myprog.cpp
)
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/file001.out DESTINATION
share/docs)
Listing all of the input files in my CMakeLists.txt file is not a problem,
but it would be nice to avoid having to list the corresponding output files.
How can I build a CMakeLists.txt file which will succinctly handle this
situation?
--
Thanks,
..chris
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/cmake/attachments/20150129/dae50239/attachment-0001.html>
More information about the CMake
mailing list