author | unc0rr |
Wed, 26 Feb 2014 23:43:42 +0400 | |
changeset 10162 | 38dbf26475d8 |
parent 9246 | 75f430ebeb74 |
permissions | -rw-r--r-- |
9246 | 1 |
# - Try to find the Clang/LLVM executable |
2 |
# Once done this will define |
|
3 |
# |
|
4 |
# CLANG_FOUND - system has Clang |
|
5 |
# CLANG_VERSION - Clang version |
|
6 |
# CLANG_EXECUTABLE - Clang executable |
|
7 |
# |
|
8 |
# Copyright (c) 2013, Vittorio Giovara <vittorio.giovara@gmail.com> |
|
9 |
# |
|
10 |
# Redistribution and use is allowed according to the terms of the BSD license. |
|
11 |
# For details see the accompanying COPYING-CMAKE-SCRIPTS file. |
|
12 |
||
13 |
find_program(CLANG_EXECUTABLE |
|
8450
404ddce27b23
add support for clang 3.3 (although there has to be a better way for this) and output right version number
koda
parents:
8113
diff
changeset
|
14 |
NAMES clang-mp-3.3 clang-mp-3.2 clang-mp-3.1 clang-mp-3.0 clang |
8109
b5cd8cad2d86
Move code for Clang to separate CMake module.
Bryan Dunsmore <dunsmoreb@gmail.com>
parents:
diff
changeset
|
15 |
PATHS /opt/local/bin /usr/local/bin /usr/bin) |
9246 | 16 |
|
17 |
if (CLANG_EXECUTABLE) |
|
18 |
execute_process(COMMAND ${CLANG_EXECUTABLE} --version |
|
19 |
OUTPUT_VARIABLE CLANG_VERSION_OUTPUT |
|
20 |
ERROR_VARIABLE CLANG_VERSION_ERROR |
|
21 |
RESULT_VARIABLE CLANG_VERSION_RESULT |
|
22 |
OUTPUT_STRIP_TRAILING_WHITESPACE |
|
23 |
) |
|
24 |
||
25 |
if(${CLANG_VERSION_RESULT} EQUAL 0) |
|
26 |
string(REGEX MATCH "[0-9]+\\.[0-9]+" CLANG_VERSION "${CLANG_VERSION_OUTPUT}") |
|
27 |
string(REGEX REPLACE "([0-9]+\\.[0-9]+)" "\\1" CLANG_VERSION "${CLANG_VERSION}") |
|
28 |
else() |
|
29 |
message(SEND_ERROR "Command \"${CLANG_EXECUTABLE} --version\" failed with output: ${CLANG_VERSION_ERROR}") |
|
30 |
endif() |
|
8113
0ad9c42dca7c
Refactor Clang module.
Bryan Dunsmore <dunsmoreb@gmail.com>
parents:
8111
diff
changeset
|
31 |
endif() |
8109
b5cd8cad2d86
Move code for Clang to separate CMake module.
Bryan Dunsmore <dunsmoreb@gmail.com>
parents:
diff
changeset
|
32 |
|
9246 | 33 |
include(FindPackageHandleStandardArgs) |
34 |
find_package_handle_standard_args(Clang DEFAULT_MSG CLANG_EXECUTABLE CLANG_VERSION) |
|
35 |
mark_as_advanced(CLANG_VERSION) |
|
8109
b5cd8cad2d86
Move code for Clang to separate CMake module.
Bryan Dunsmore <dunsmoreb@gmail.com>
parents:
diff
changeset
|
36 |