File: FindGDB.cmake

package info (click to toggle)
freespace2 24.0.2%2Brepack-1
  • links: PTS, VCS
  • area: non-free
  • in suites: trixie
  • size: 43,188 kB
  • sloc: cpp: 583,107; ansic: 21,729; python: 1,174; sh: 464; makefile: 248; xml: 181
file content (74 lines) | stat: -rw-r--r-- 1,598 bytes parent folder | download | duplicates (7)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
# - Try to find GDB
#
# Once done, this will define:
#  GDB_FOUND - system has GDB
#  GDB_COMMAND - the command to run
#  GDB_VERSION - version
#  GDB_HAS_RETURN_CHILD_RESULT - if the --return-child-result flag is supported
#
# Useful configuration variables you might want to add to your cache:
#  GDB_ROOT_DIR - A directory prefix to search
#
# Original Author:
# 2009-2010 Ryan Pavlik <rpavlik@iastate.edu> <abiryan@ryand.net>
# http://academic.cleardefinition.com
# Iowa State University HCI Graduate Program/VRAC
#
# Copyright Iowa State University 2009-2010.
# Distributed under the Boost Software License, Version 1.0.
# (See accompanying file LICENSE_1_0.txt or copy at
# http://www.boost.org/LICENSE_1_0.txt)


set(GDB_ROOT_DIR
	"${GDB_ROOT_DIR}"
	CACHE
	PATH
	"Directory to start our search in")

find_program(GDB_COMMAND
	NAMES
	gdb
	HINTS
	"${GDB_ROOT_DIR}"
	PATH_SUFFIXES
	bin
	libexec)

if(GDB_COMMAND)
	execute_process(COMMAND
		gdb
		--version
		COMMAND
		head
		-n
		1
		OUTPUT_VARIABLE
		GDB_VERSION
		OUTPUT_STRIP_TRAILING_WHITESPACE)
	string(REGEX
		REPLACE
		"[^0-9]*([0-9]+[0-9.]*).*"
		"\\1"
		GDB_VERSION
		"${GDB_VERSION}")
endif()

# handle the QUIETLY and REQUIRED arguments and set xxx_FOUND to TRUE if
# all listed variables are TRUE
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(GDB
	DEFAULT_MSG
	GDB_COMMAND
	GDB_VERSION)

if(GDB_FOUND)
	mark_as_advanced(GDB_ROOT_DIR)
	if(GDB_VERSION VERSION_LESS 6.4)
		set(GDB_HAS_RETURN_CHILD_RESULT FALSE)
	else()
		set(GDB_HAS_RETURN_CHILD_RESULT TRUE)
	endif()
endif()

mark_as_advanced(GDB_COMMAND)