[cmake-developers] CMake instances sharing some modifiable resources
Robert Goulet
Robert.Goulet at autodesk.com
Wed Jun 17 16:56:55 EDT 2015
Hi all,
I'm trying to write a custom command that will run a CMake script to add some content in a file. Problem is, if I'm building with multiple process enabled in Visual Studio project, and the custom command is added to a few different CMakeLists.txt files, I get synchronizations issues.
In my a bunch of CMakeLists.txt I have:
add_custom_command(TARGET ${PROJECT_NAME} POST_BUILD COMMAND ${CMAKE_COMMAND} ARGS -P "file_append.cmake")
In file_append.cmake I have:
file(APPEND "output.txt" "some content\n")
When looking at the content of output.txt, we see that some lines are truncated, half-written or skipped entirely. Is there a way to make the file command lock the file during the append so that multiple process sharing some modifiable resource do not run into conflict between each other? I saw the file(LOCK...) command but it doesn't seems to work for this case?
Thanks!
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/cmake-developers/attachments/20150617/e85c15b1/attachment.html>
More information about the cmake-developers
mailing list