Imagine the following lines in a CMakeFiles.txt:
add_custom_target( target
cd bin
COMMAND echo "test" > README
)
make target
will not work as expected, as it will not modify the file bin/README
but rather the file ./README
. I found out that, in order to make CMake modify bin/README
, I have to write
COMMAND cd bin && echo "test" > README
which is time consuming and blows the CMakeLists up when used multiple times. I want a behavior that is much like the behaviour of shell scripts. How can I achieve this?