alistair23-linux-firmware/carl9170fw/extra/GCCVersion.cmake

43 lines
1.4 KiB
CMake

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