bzr branch
http://suren.me/webbzr/alps/pcitool
348
by Suren A. Chilingaryan
Add build information |
1 |
#
|
2 |
# This program source code file is part of KICAD, a free EDA CAD application.
|
|
3 |
#
|
|
4 |
# Copyright (C) 2010 Wayne Stambaugh <stambaughw@verizon.net>
|
|
5 |
# Copyright (C) 2010 Kicad Developers, see AUTHORS.txt for contributors.
|
|
6 |
#
|
|
7 |
# This program is free software; you can redistribute it and/or
|
|
8 |
# modify it under the terms of the GNU General Public License
|
|
9 |
# as published by the Free Software Foundation; either version 2
|
|
10 |
# of the License, or (at your option) any later version.
|
|
11 |
#
|
|
12 |
# This program is distributed in the hope that it will be useful,
|
|
13 |
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
14 |
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
15 |
# GNU General Public License for more details.
|
|
16 |
#
|
|
17 |
# You should have received a copy of the GNU General Public License
|
|
18 |
# along with this program; if not, you may find one here:
|
|
19 |
# http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
|
20 |
# or you may search the http://www.gnu.org website for the version 2 license,
|
|
21 |
# or you may write to the Free Software Foundation, Inc.,
|
|
22 |
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
|
23 |
#
|
|
24 |
# This CMake script finds the BAZAAR version control system executable and
|
|
25 |
# and fetches the veresion string to valid that BAZAAR was found and executes
|
|
26 |
# properly.
|
|
27 |
#
|
|
28 |
# Usage:
|
|
29 |
# find_package( BAZAAR )
|
|
30 |
#
|
|
31 |
# User definable.
|
|
32 |
# BAZAAR_EXECUTABLE Set this to use a version of BAZAAR that is not in
|
|
33 |
# current path. Defaults to bzr.
|
|
34 |
#
|
|
35 |
# Defines:
|
|
36 |
# BAZAAR_FOUND Set to TRUE if BAZAAR command line client is found
|
|
37 |
# and the bzr --version command executes properly.
|
|
38 |
# BAZAAR_VERSION Result of the bzr --version command.
|
|
39 |
#
|
|
40 |
||
41 |
set( BAZAAR_FOUND FALSE ) |
|
42 |
||
43 |
find_program( BAZAAR_EXECUTABLE bzr |
|
44 |
DOC "BAZAAR version control system command line client" ) |
|
45 |
mark_as_advanced( BAZAAR_EXECUTABLE ) |
|
46 |
||
47 |
if( BAZAAR_EXECUTABLE ) |
|
48 |
||
49 |
# BAZAAR commands should be executed with the C locale, otherwise
|
|
50 |
# the message (which are parsed) may be translated causing the regular
|
|
51 |
# expressions to fail.
|
|
52 |
set( _BAZAAR_SAVED_LC_ALL "$ENV{LC_ALL}" ) |
|
53 |
set( ENV{LC_ALL} C ) |
|
54 |
||
55 |
# Fetch the BAZAAR executable version.
|
|
56 |
execute_process( COMMAND ${BAZAAR_EXECUTABLE} --version |
|
57 |
OUTPUT_VARIABLE _bzr_version_output |
|
58 |
ERROR_VARIABLE _bzr_version_error |
|
59 |
RESULT_VARIABLE _bzr_version_result |
|
60 |
OUTPUT_STRIP_TRAILING_WHITESPACE ) |
|
61 |
||
62 |
if( ${_bzr_version_result} EQUAL 0 ) |
|
63 |
set( BAZAAR_FOUND TRUE ) |
|
64 |
string( REGEX REPLACE "^[\n]*Bazaar \\(bzr\\) ([0-9.a-z]+).*" |
|
65 |
"\\1" BAZAAR_VERSION "${_bzr_version_output}" ) |
|
66 |
if( NOT BAZAAR_FIND_QUIETLY ) |
|
67 |
message( STATUS "BAZAAR version control system version ${BAZAAR_VERSION} found." ) |
|
68 |
endif() |
|
69 |
endif() |
|
70 |
||
71 |
# restore the previous LC_ALL
|
|
72 |
set( ENV{LC_ALL} ${_BAZAAR_SAVED_LC_ALL} ) |
|
73 |
endif() |
|
74 |
||
75 |
if( NOT BAZAAR_FOUND ) |
|
76 |
if( NOT BAZAAR_FIND_QUIETLY ) |
|
77 |
message( STATUS "BAZAAR version control command line client was not found." ) |
|
78 |
else() |
|
79 |
if( BAZAAR_FIND_REQUIRED ) |
|
80 |
message( FATAL_ERROR "BAZAAR version control command line client was not found." ) |
|
81 |
endif() |
|
82 |
endif() |
|
83 |
endif() |