How do I run a .bat file from CMake in a pre-link or a post-build event?
Asked
Active
Viewed 1.6k times
2 Answers
6
The following also works. In case you read or create a file inside the bat script don't forget to specify the exact path inside the bat script.
ADD_CUSTOM_TARGET(
myCustomTarget
COMMAND cmd /c E:/Myfiles/mytxt.bat
)
ADD_DEPENDENCIES(myTarget myCustomTarget)
myTarget will be executed after myCustomTarget.

Peter Mortensen
- 30,738
- 21
- 105
- 131

Vsegar
- 113
- 1
- 8
-
The /c is important. For those who missed it like I did. – Rohit Kumar J Mar 26 '23 at 12:33