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!
--
Powered by www.kitware.com
Please keep messages on-topic and check the CMake FAQ at:
http://www.cmake.org/Wiki/CMake_FAQ
Kitware offers various services to support the CMake community. For more
information on each offering, please visit:
CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html
Visit other Kitware open-source projects at
http://www.kitware.com/opensource/opensource.html
Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/cmake-developers