Issue
I use CMake like that:
$ mkdir build && cd build
$ cmake .. && make && atf-run | atf-report
But to run atf I need some files (for example /Atffile and test/Atffile), so I'm looking for a way to import in my build directory all that kind file.
I tried this:
file(COPY ${PROJECT_SOURCE_DIR}/.. DESTINATION ${PROJECT_SOURCE_DIR}/..)
But it doesn't work. Is their a simple/cleaner way to do it?
Solution
Assuming "/Atffile" and "/test/Atffile" are files and not folders, you can use [configure_file
][1]
configure_file(Atffile Atffile COPYONLY)
configure_file(test/Atffile test/Atffile COPYONLY)
Since the commands here use relative paths throughout, the input arg is relative to the current source directory and the output arg is relative to the current binary (i.e. build) directory.
[1]: https://cmake.org/cmake/help/latest/command/configure_file.html "CMake documentation for "configure_file" command"
Answered By - Fraser Answer Checked By - Marilyn (WPSolving Volunteer)