This question is based on the following SO thread to disable in-source build: while the following setup disable in-source build, it left garbage like "CMakeCache.txt" and "CMakeFiles/". I tried to use file() command to remove it, but it appears no effect. Any idea?
if ( ${CMAKE_SOURCE_DIR} STREQUAL ${CMAKE_BINARY_DIR} ) file(REMOVE CMakeCache.txt) message( FATAL_ERROR "In-source builds not allowed.) endif()
CMakeCache.txteven after failure in configuration. So removing this file during configuration has no effect.