Originally from: https://cmake.org/Bug/view.php?id=15769

Here is the scenario of not triggering rebuild of project while CMakeLists.txt changed:
1. Create CMakeLists.txt (modification time 100 units)
2. Run generate (create project from scratch): `cmake -H. -B_builds`. Takes 5 units, Makefile created with modification time 105 3. Apply changes to CMakeLists.txt "immediately", CMakeLists.txt modification time 105 4. Run rebuild: `cmake --build _builds`. Since CMakeLists.txt (105) is not "newer" then Makefile (105) there will be no regenerate command run and Makefile remains the same

Error can be easily reproduced on Apple HFS file system with unit = 1s (I hit this problem doing changes even manually) but in general that's the "feature" of native make tool + file system date resolution. Here is the similar test for Linux with ext4:
Test: https://github.com/forexample/date-resolution-test
Log: https://travis-ci.org/forexample/date-resolution-test/builds/85021483

There are a lot of scenarios where such problems can occurs, e.g. installing files (reproducible on OSX and Linux):
* https://cmake.org/pipermail/cmake-developers/2015-October/026692.html

One more with sources:
* Create foo.cpp (100) which build executable foo
* Run generate and build foo (105)
* Modify foo.cpp "immediately" -> foo.cpp (105)
* Run build (may be repeated N times): cmake --build _builds, no changes (!)
* Run regenerate (may be repeated N times): cmake -H. -B_builds, no changes (!)

My excerpts from bug:

    > I wouldn't expect every tool that can create a file to have an
   option to sleep after creating it.
   There is no need to sleep after each file creation it should be
   enough to sleep after generate/build step. I.e. in `cmake -H.
   -B_builds` and `cmake --build _builds` commands, but not in `cmake -E`.

   So experiencing such problems on other file systems just a matter of
   test and hardware capabilities which lead to
   unpredictable/unrepeatable bugs and makes it VERY hard to debug
   (e.g. to fix first test /*not the first, see example with sources*/
   it's not even enough to just re-run `cmake -H. -B_builds` - you
   should remove your build directory or touch files one more time
   after some pause). Again I understand that it's not a problem in
   CMake but if there is any chance to apply some "guarding"
   functionality it should be used. I'll take a look more deeply next
   week and will report my thoughts.

Any other ideas?

Ruslo
-- 

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

Reply via email to