cmake_modules/FindClang.cmake
author Wuzzy <Wuzzy2@mail.ru>
Tue, 28 Aug 2018 05:46:33 +0200
changeset 13710 0da36902e5b6
parent 9246 75f430ebeb74
permissions -rw-r--r--
Space Invasion: Continue playing rounds in case the teams are tied at the end Rules in case of a tie: 1) Eliminate all teams not tied for the lead 2) Play another round with the remaining teams 3) Check for the winner again at the end of that round. If there's another tie, repeat the procedure

# - Try to find the Clang/LLVM executable
# Once done this will define
#
#  CLANG_FOUND       - system has Clang
#  CLANG_VERSION     - Clang version
#  CLANG_EXECUTABLE  - Clang executable
#
# Copyright (c) 2013, Vittorio Giovara <vittorio.giovara@gmail.com>
#
# Redistribution and use is allowed according to the terms of the BSD license.
# For details see the accompanying COPYING-CMAKE-SCRIPTS file.

find_program(CLANG_EXECUTABLE
        NAMES clang-mp-3.3 clang-mp-3.2 clang-mp-3.1 clang-mp-3.0 clang
        PATHS /opt/local/bin /usr/local/bin /usr/bin)

if (CLANG_EXECUTABLE)
    execute_process(COMMAND ${CLANG_EXECUTABLE} --version
                    OUTPUT_VARIABLE CLANG_VERSION_OUTPUT
                    ERROR_VARIABLE CLANG_VERSION_ERROR
                    RESULT_VARIABLE CLANG_VERSION_RESULT
                    OUTPUT_STRIP_TRAILING_WHITESPACE
                    )

    if(${CLANG_VERSION_RESULT} EQUAL 0)
        string(REGEX MATCH "[0-9]+\\.[0-9]+" CLANG_VERSION "${CLANG_VERSION_OUTPUT}")
        string(REGEX REPLACE "([0-9]+\\.[0-9]+)" "\\1" CLANG_VERSION "${CLANG_VERSION}")
    else()
        message(SEND_ERROR "Command \"${CLANG_EXECUTABLE} --version\" failed with output: ${CLANG_VERSION_ERROR}")
    endif()
endif()

include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(Clang DEFAULT_MSG CLANG_EXECUTABLE CLANG_VERSION)
mark_as_advanced(CLANG_VERSION)