[CMake] Disallowing in-source builds

Philip Lowman philip at yhbt.com
Thu Oct 7 00:08:01 EDT 2010


On Wed, Oct 6, 2010 at 2:10 PM, <aaron.meadows at thomsonreuters.com> wrote:

>  *Hi all.*
>
> * *
>
> *Is there a good way to disallow in-source builds?  Ideally, I’d like to
> prevent it before any cruft is written into the source tree.  I experimented
> with writing a function into my CMakelists file and calling it.  The
> function checked if CMAKE_BINARY_DIR was equal to CMAKE_SOURCE_DIR and
> messaged a FATAL_ERROR if that was the case.  This works ok, but still
> generates a CMakeFiles directory and a CMakeCache.txt file.*
>


> * **The second half of the question is of course, 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..)*
>

CMake doesn't have a command to clean up after itself which seems to be what
you're asking for (it would help for both use-cases you specify).  This is
kind of related to my ticket asking for a distclean target, so I'll just
throw it out there in case anyone has some free time on their hands.

http://www.cmake.org/Bug/view.php?id=6647

-- 
Philip Lowman
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20101007/3c445c11/attachment-0001.htm>


More information about the CMake mailing list