1#
2# See what sort of version control bits we might have around.
3#
4
5
6# See if we're building from a bzr checkout.  This is fragile in the
7# sense that it'll break if the bzr WT format changes, but that's
8# staggeringly unlikely now, so...
9set(BZR_DIRSTATE_FILE ${CMAKE_SOURCE_DIR}/.bzr/checkout/dirstate)
10if(EXISTS ${BZR_DIRSTATE_FILE})
11	set(IS_BZR_CO 1)
12else()
13	set(IS_BZR_CO 0)
14endif()
15
16
17# If we are, see if we can find bzr(1) installed
18set(HAS_BZR 0)
19if(IS_BZR_CO)
20	find_program(BZR_CMD NAMES bzr brz)
21	if(BZR_CMD)
22		set(HAS_BZR 1)
23		message(STATUS "Building from a checkout and found bzr (${BZR_CMD}).")
24	else()
25		message(STATUS "Building from a checkout, but no bzr found.")
26	endif(BZR_CMD)
27else()
28	message(STATUS "You aren't building from a bzr checkout.")
29endif(IS_BZR_CO)
30
31
32# If not bzr, do a little check to see if we're building from git instead
33if(NOT IS_BZR_CO)
34	set(GIT_INDEX_FILE ${CMAKE_SOURCE_DIR}/.git/index)
35	set(IS_GIT_CO 0)
36	if(EXISTS ${GIT_INDEX_FILE})
37		set(IS_GIT_CO 1)
38	endif()
39
40	if(IS_GIT_CO)
41		set(HAS_GIT 0)
42		find_program(GIT_CMD git)
43		if(GIT_CMD)
44			set(HAS_GIT 1)
45			message(STATUS "Building from git repo and found git (${GIT_CMD}).")
46		else()
47			message(STATUS "Building from git repo, but no git found.")
48		endif(GIT_CMD)
49	endif(IS_GIT_CO)
50endif(NOT IS_BZR_CO)
51
52
53# Flag for dev use
54set(VCS_CHECKS_RUN 1)
55