User1291
User1291

Reputation: 8209

CGAL - clock slew when making?

I'm tired of manually executing one command after another just to compile a C++11 program that makes use of CGAL.

So I thought I'd create a small .sh file that would take care of it for me:

#!/bin/bash

cgal_create_cmake_script &&
cmake . &&
echo "set(CMAKE_CXX_FLAGS \"${CMAKE_CXX_FLAGS} -std=c++11\")" >> CMakeList.txt &&
make

I don't really know much about bash scripts, but this seems to work well enough. However, I'm constantly getting warnings that

make: Warning: File 'Makefile' has modification time 2.4 s in the future

make[1]: Warning: File 'CMakeFiles/Makefile2' has modification time 2.4 s in the future

make[2]: Warning: File 'CMakeFiles/my_dir.dir/progress.make' has modification time 2.4 s in the future

Now, as much as I'd like a computer capable of predicting the future, I'm not really happy about this. What am I doing wrong?

Upvotes: 0

Views: 89

Answers (1)

chepner
chepner

Reputation: 532113

Your Makefile is being created on a remote file system, so the timestamp is recorded using the server's clock, which appears to be fast (or your machine's clock is slow). make, however, is running on your local machine, so when it sees your Makefile, it appears to have been created in the future.

The right thing to do is to fix whichever clock is off. (Ideally, both machines should be using something like NTP to synchronize with a standard clock.)

A quick hack would be to add a sleep command to the list

cgal_create_cmake_script &&
cmake . &&
echo "set(CMAKE_CXX_FLAGS \"${CMAKE_CXX_FLAGS} -std=c++11\")" >> CMakeList.txt &&
sleep 3 &&
make

so that your local clock can "catch up" and make the remote file appear to have been created in the past instead of the future.

Upvotes: 3

Related Questions