[Cmake] Unwanted automatic rebuilding of Visual Studio projects

Karr, David David . Karr at titan . com
Thu, 4 Dec 2003 15:57:50 -0500


When I edit one of the CMake files, e.g. CMakeLists.txt, and
rebuild my workspace in Visual Studio, all the affected .dsp=20
files are modified, causing Visual Studio to prompt me to
reload each of those projects.  This is a behavior that makes
sense, although it is annoying when I forget to close my workspace
before editing a file that affects all projects, because there
are dozens of projects in this workspace and Visual Studio wastes
a lot of my time prompting me for each one individually.

What is even more annoying is when all these .dsp files get
touched somehow when nobody has edited any of the input to CMake.
That is, for no apparent reason (other than that the developer is
trying to compile a newly-edited C++ source file, which of course
is a very frequent occurrence), Visual Studio will start=20
prompting the developer to reload each one of the several dozen
projects in the workspace.

One of the developers on my project is seeing this happen=20
repeatedly while working in a ClearCase dynamic view.
Other developers have noticed the same thing in snapshot views
or even in ordinary (not source-controlled) folders on hosts
whose system clocks are a bit irregular (apparently these=20
hosts keep getting out of synch with a time server and get=20
their clocks automatically reset from time to time).
I'm almost sure none of these developers was actually
editing any of the CMake input files at any time near when
the .dsp files got regenerated; it seems to be just a timing
glitch of some sort.

My question is, is there any way to make our workspace less
susceptible to this kind of unpleasant behavior?

I have a batch file that initially runs CMake to create the
workspace and all the .dsp files, and we'd be happy if this
were the *only* way CMake was run, rather than having rules
in the .dsp files themselves to re-run CMake.  Of course
then we'd have to remember to run CMake manually when something
actually changed, but that's a small inconvenience compared to
what we're facing now.  But it seems that CMake automatically
adds the rule for CMakeLists.txt to each .dsp file and there
seems to be no way to turn this feature off other than by
compiling and running a hacked version of CMake itself.
Is there a better way?

David Karr