I have a project that generates a shell script at CMake time (with file(WRITE. How can I get CMake to treat this shell script as an executable of the project (e.g. have it cleaned up, “rebuild”, and also installed)?
I have a project that generates a shell script at CMake time (with file(WRITE
Share
First, take a look at configure_file() function, it can do all the work for you. If you can’t use it, you should add_custom_command(), which would produce your file and then add_custom_target(), which should
DEPENDSon${CMAKE_BINARY_DIR}/your_produced_file.In
add_custom_command()invokation you can use something like that: