In all my projects, the top-level CMakeLists.txt contains the line
include(PreventInSourceBuilds) to protect users (and myself) from unintentionally running CMake in the source directory. Would you consider adding this little module to the CMake code base? I would then add an option so that users can override the not-in-source policy. /Joachim --- #.rst: # PreventInSourceBuilds # --------------------- # # Prevent in-source builds # # It is generally acknowledged that it is preferable to run CMake out of source, # in a dedicated build directory. To prevent users from accidentally running # CMake in the source directory, just include this module. # make sure the user doesn't play dirty with symlinks get_filename_component(srcdir "${CMAKE_SOURCE_DIR}" REALPATH) get_filename_component(bindir "${CMAKE_BINARY_DIR}" REALPATH) # disallow in-source builds if("${srcdir}" STREQUAL "${bindir}") message(FATAL_ERROR "\ CMake must not to be run in the source directory. \ Rather create a dedicated build directory and run CMake there. \ To clean up after this aborted in-source compilation: rm -r CMakeCache.txt CMakeFiles ") endif()
smime.p7s
Description: S/MIME Cryptographic Signature
-- Powered by www.kitware.com Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Kitware offers various services to support the CMake community. For more information on each offering, please visit: CMake Support: http://cmake.org/cmake/help/support.html CMake Consulting: http://cmake.org/cmake/help/consulting.html CMake Training Courses: http://cmake.org/cmake/help/training.html Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Follow this link to subscribe/unsubscribe: https://cmake.org/mailman/listinfo/cmake-developers