Reputation: 177
I am looking for a way to build some c, c++ files in CMAKE everytime when I type the make command whatever I modify the file or not. Because those file include build information codes such as build time. It this possible in CMAKE?
Thank you in advance.
Upvotes: 7
Views: 4904
Reputation: 54737
You can use the add_custom_target
command to add a target that will be executed for every build.
For example, you can use the CMake touch command to mark certain source files dirty, so they get rebuild on every run:
add_custom_target(invalidate_files ALL
COMMAND ${CMAKE_COMMAND} -E touch ${MY_SRC_FILE})
Upvotes: 12