now = get_now_time() time = get_last_upd_time() if (now > time) set (LAST_UPD_TIME time CACHE INTERNAL "Defines last update time of the file" FORCE)
get_now_time and get_last_upd_time are fictitious functions that return timestamps (I think you can use bash commands to get these timestamps). Then you can compare them and save the timestamp of the last modification in the cache.
However, this decision looks ugly to me, as I know if you correctly define goals and the relationships between them. CMake will take care of recovering only the modified files, right? Could you show me the target definitions?
change
You can use the following CMakeLists.txt (you are not sure, it is based on my project):
# add main target, the executable file ADD_EXECUTABLE(gitbrowser main.cpp view.cpp content.hpp gitbrowser.cpp) # linking it with necessary libraries TARGET_LINK_LIBRARIES(gitbrowser "cppcms config++ boost_filesystem-mt") # add page.cpp target ADD_CUSTOM_COMMAND( OUTPUT page.cpp COMMAND "cppcms_tmpl_cc page.tmpl -o view.cpp" DEPENDS page.tmpl content.hpp ) # and finally add dependency of the main target ADD_DEPENDENCIES(gitbrowser page.cpp)
Good luck.
source share