[cmake-developers] New command 'file(LOCK_DIRECTORY ...)'

Ben Boeckel ben.boeckel at kitware.com
Mon Oct 13 10:34:30 EDT 2014


On Fri, Oct 10, 2014 at 17:59:07 +0400, Ruslan Baratov via cmake-developers wrote:
> > Behavior when there's a lock that still exists (by bug/mistake) after
> > CMake is done running is going to be strange and possibly
> > hard-to-diagnose / hard-to-understand.
> That's *exactly* the problem I have and why I start this discussion. 
> Currently I'm using mkdir command which return 0 only if directory 
> created by current process (just to clarify, not the cmake -E 
> make_directory). This works fine for me (tested on windows (mingw, 
> cygwin), linux and mac). But I can't (or I don't know how) make remove 
> this directory when I Ctrl+C my build (or abort the job on jenkins 
> server). My current implementation just keep spinning with message: 
> "Directory locked by cmake, build started in directory 
> <cmake-binary-dir> at <timestamp>".

Maybe we need something like the 'trap' shell builtin which runs code on
various triggers rather than something like file/directory locks which
are…hairy (especially in the face of things like NFS or Samba)? I can
think of at least:

  - end of configure
  - end of generate
  - end of directory scope
  - end of scope (function or directory)

--Ben



More information about the cmake-developers mailing list