[CMake] "make superclean" target? (i.e. clear *everything*)
Jean-Christophe Fillion-Robin
jchris.fillionr at kitware.com
Thu Apr 4 12:53:56 EDT 2013
Consider looking at the implementation of PreventInSourceBuilds.cmake in ITK
See
https://github.com/Kitware/ITK/blob/master/CMake/PreventInSourceBuilds.cmake
May it could be generalized and integrated in CMake itself ?
Jc
On Thu, Apr 4, 2013 at 12:49 PM, Andreas Stahl
<andreas.stahl at tu-dresden.de>wrote:
>
> Am 04.04.2013 um 17:31 schrieb Brian Milco:
>
> >
> > On Thu, Apr 4, 2013 at 6:01 AM, Daniele E. Domenichelli <
> daniele.domenichelli at gmail.com> wrote:
> > One benefit is that it would allow to easily remove all cmake files when
> > you wrongly run cmake in the source directory instead of in the build
> one.
> >
> >
> > A while ago I found the attached macro online[1]. It stops the build
> process early on preventing an in source build.
> > Since it has to start the process to work you still get a CMakeCache.txt
> file and CMakeFiles directory but those are easy enough to remove compared
> to picking through your whole source tree.
> >
> > To use it place the Macro as close to the top of your master
> CMakeLists.txt file as you can and call it with something like:
> >
> > # Appends the path where you are keeping this Macro
> > set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules
> ${CMAKE_MODULE_PATH})
> >
> > #Forces out of source builds just in case.
> > include(MacroOutOfSourceBuild)
> > macro_ensure_out_of_source_build("${PROJECT_NAME} requires an out of
> source build.")
> >
> > -Brian
> >
> > [1]
> https://github.com/DisCODe/DisCODe/blob/master/cmake/modules/MacroOutOfSourceBuild.cmake
> > <MacroOutOfSourceBuild.cmake>--
> >
> > Powered by www.kitware.com
> >
> > Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
> >
> > Please keep messages on-topic and check the CMake FAQ at:
> http://www.cmake.org/Wiki/CMake_FAQ
> >
> > Follow this link to subscribe/unsubscribe:
> > http://www.cmake.org/mailman/listinfo/cmake
> Hi all,
>
> What about just doing a string comparison on the <ProjectName>_SOURCE_DIR
> and <ProjectName>_BINARY_DIR? No need to include a file for what is
> effectively three lines:
>
> if(${MyProj_SOURCE_DIR} STREQUAL ${MyProj_BINARY_DIR})
> message(FATAL_ERROR "Only out-of source builds allowed at the
> moment.")
> endif()
>
> Or are there some traps I'm not seeing with this method?
>
> Andreas
>
>
>
> --
>
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
>
> Please keep messages on-topic and check the CMake FAQ at:
> http://www.cmake.org/Wiki/CMake_FAQ
>
> Follow this link to subscribe/unsubscribe:
> http://www.cmake.org/mailman/listinfo/cmake
>
--
+1 919 869 8849
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20130404/34eb8dde/attachment-0001.htm>
More information about the CMake
mailing list