]> Creatis software - crea.git/blob - cmake/CREAMacro_PreventInSourceBuild.cmake
Add Warning
[crea.git] / cmake / CREAMacro_PreventInSourceBuild.cmake
1
2 MACRO(CREA_PREVENT_IN_SOURCE_BUILD)
3   IF(NOT CREA_ALLOW_IN_SOURCE_BUILD)
4     #------------------------------------------------------------------------
5     # Building in the source tree is forbidden ! 
6     # except if CREA_ALLOW_IN_SOURCE_BUILD is set, 
7     # e.g. for packaging with rpmbuild
8     IF(PROJECT_BINARY_DIR STREQUAL ${PROJECT_SOURCE_DIR})
9       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")
10     ENDIF(PROJECT_BINARY_DIR STREQUAL ${PROJECT_SOURCE_DIR})
11     #------------------------------------------------------------------------
12   ENDIF(NOT CREA_ALLOW_IN_SOURCE_BUILD)
13 ENDMACRO(CREA_PREVENT_IN_SOURCE_BUILD)