1 #=============================================================================
2 # Copyright 2006-2009 Kitware, Inc.
3 # Copyright 2006-2008 Andreas Schneider <mail@cynapses.org>
5 # Copyright 2007 Mike Jackson
6 # Copyright 2008 Andreas Pakulat <apaku@gmx.de>
7 # Copyright 2008-2009 Philip Lowman <philip@yhbt.com>
9 # Distributed under the OSI-approved BSD License (the "License");
10 # see accompanying file Copyright.txt for details.
12 # This software is distributed WITHOUT ANY WARRANTY; without even the
13 # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
14 # See the License for more information.
15 #=============================================================================
16 # (To distributed this file outside of CMake, substitute the full
17 # License text for the above reference.)
19 #-------------------------------------------------------------------------------
22 # Runs compiler with "-dumpversion" and parses major/minor
23 # version with a regex.
25 FUNCTION(_COMPILER_DUMPVERSION _OUTPUT_VERSION)
27 EXEC_PROGRAM(${CMAKE_C_COMPILER}
28 ARGS ${CMAKE_C_COMPILER_ARG1} -dumpversion
29 OUTPUT_VARIABLE _COMPILER_VERSION
31 STRING(REGEX REPLACE "([0-9])\\.([0-9])(\\.[0-9])?" "\\1\\2"
32 _COMPILER_VERSION ${_COMPILER_VERSION})
34 SET(${_OUTPUT_VERSION} ${_COMPILER_VERSION} PARENT_SCOPE)
38 # End functions/macros
40 #-------------------------------------------------------------------------------