[CMake] Disallowing in-source builds
fatman at crackmonkey.us
fatman at crackmonkey.us
Thu Oct 7 05:21:29 EDT 2010
> > is there an easy way to clean out a source tree if an in-source
> > build was accidentally kicked off? (short of dividing the files by
> > their timestamp and removing the newer ones, etc..)
My immediate thought was, does "make clean" not work for you? But I
guess you're talking about CMake debris rather than make debris.
> > Ideally, I?d
> > like to prevent it before any cruft is written into the source
> > tree.
I suggest an alternative. I think I read about it on this list but I'm
not sure.
What I do is provide an empty "cmake" folder in my source tree root, and
run all CMake commands in it. This ensures all the CMake cruft is
contained in one in-source folder. (I guess you could modify this so
it's out-source.)
To re-run the rootwards-most CMakeLists.txt file:
cd projectx/cmake && cmake ..
Then, to clear all CMake debris:
rm -r projectx/cmake/*
(insert usual disclaimer on rm usage)
This doesn't prevent anything, but it does at least make it
easy to build in-source without cluttering the source tree.
> > Is there a good way to disallow in-source builds?
Probably the best way is to circulate an email stating "the lead
developer has threatened to eat^H^H^H^H fire anyone who builds
in-source".
You could maybe do something with user permissions and build
scripts. Make sure the build scripts only work in one place.
Regards,
Adam J Richardson
More information about the CMake
mailing list