]> Creatis software - bbtk.git/blobdiff - kernel/cmake/BBTKPreventInSourceBuild.cmake
*** empty log message ***
[bbtk.git] / kernel / cmake / BBTKPreventInSourceBuild.cmake
index de12a492d72a5112866f5d3e82a4ecba663a6268..8126ce8985a8c3f1c4f5f8361ed9a467965df05e 100644 (file)
@@ -1,6 +1,9 @@
-#-----------------------------------------------------------------------------
-# Building in the source tree is forbidden ! 
-IF(PROJECT_BINARY_DIR STREQUAL ${PROJECT_SOURCE_DIR})
-  MESSAGE(FATAL_ERROR "Building in the source tree is not allowed !! Quit; remove the file 'CMakeCache.txt' and the folder 'CMakeFiles' and build outside the sources")
-ENDIF(PROJECT_BINARY_DIR STREQUAL ${PROJECT_SOURCE_DIR})
-#-----------------------------------------------------------------------------
+IF(NOT ALLOW_IN_SOURCE_BUILD)
+  #---------------------------------------------------------------------------
+  # Building in the source tree is forbidden ! 
+  # (except if ALLOW_IN_SOURCE_BUILD is set, e.g. for packaging with rpmbuild)
+  IF(PROJECT_BINARY_DIR STREQUAL ${PROJECT_SOURCE_DIR})
+    MESSAGE(FATAL_ERROR "Building in the source tree is not allowed !! Quit; remove the file 'CMakeCache.txt' and the folder 'CMakeFiles' and build outside the sources")
+  ENDIF(PROJECT_BINARY_DIR STREQUAL ${PROJECT_SOURCE_DIR})
+  #---------------------------------------------------------------------------
+ENDIF(NOT ALLOW_IN_SOURCE_BUILD)