You say you want to run the file after your build. execute_process()
runs at CMake-time, not at build time. What you're looking for would be add_custom_command()
:
add_executable(LicenseStamper stamper.cpp)
add_custom_command(
OUTPUT stamped_file.lic
COMMAND LicenseStamper any other arguments
DEPENDS any/dependency.file
COMMENT "Stamping the license"
VERBATIM
)
add_custom_target(
StampTheLicense ALL
DEPENDS stamped_file.lic
)
The custom command will run the executable (and build it first, if necessary). The custom target will drive the custom command - it depends on the command's output, so when the target is built, it will require its dependency to be built, causing the custom command to run.