On Thu, Apr 4, 2013 at 6:01 AM, Daniele E. Domenichelli < [email protected]> 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
Description: Binary data
-- 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
