author | Michael Hartman <omh1280@gmail.com> |
Sun, 30 Dec 2012 09:48:52 -0500 | |
branch | webgl |
changeset 8338 | cfad3738132c |
parent 8113 | 0ad9c42dca7c |
child 8450 | 404ddce27b23 |
permissions | -rw-r--r-- |
8109
b5cd8cad2d86
Move code for Clang to separate CMake module.
Bryan Dunsmore <dunsmoreb@gmail.com>
parents:
diff
changeset
|
1 |
# Load LLVM/Clang |
8113
0ad9c42dca7c
Refactor Clang module.
Bryan Dunsmore <dunsmoreb@gmail.com>
parents:
8111
diff
changeset
|
2 |
if (CLANG) |
0ad9c42dca7c
Refactor Clang module.
Bryan Dunsmore <dunsmoreb@gmail.com>
parents:
8111
diff
changeset
|
3 |
set(CLANG_EXECUTABLE ${CLANG}) |
0ad9c42dca7c
Refactor Clang module.
Bryan Dunsmore <dunsmoreb@gmail.com>
parents:
8111
diff
changeset
|
4 |
else() |
0ad9c42dca7c
Refactor Clang module.
Bryan Dunsmore <dunsmoreb@gmail.com>
parents:
8111
diff
changeset
|
5 |
find_program(CLANG_EXECUTABLE |
8109
b5cd8cad2d86
Move code for Clang to separate CMake module.
Bryan Dunsmore <dunsmoreb@gmail.com>
parents:
diff
changeset
|
6 |
NAMES clang-mp-3.2 clang-mp-3.1 clang-mp-3.0 clang |
b5cd8cad2d86
Move code for Clang to separate CMake module.
Bryan Dunsmore <dunsmoreb@gmail.com>
parents:
diff
changeset
|
7 |
PATHS /opt/local/bin /usr/local/bin /usr/bin) |
8113
0ad9c42dca7c
Refactor Clang module.
Bryan Dunsmore <dunsmoreb@gmail.com>
parents:
8111
diff
changeset
|
8 |
endif() |
8109
b5cd8cad2d86
Move code for Clang to separate CMake module.
Bryan Dunsmore <dunsmoreb@gmail.com>
parents:
diff
changeset
|
9 |
|
b5cd8cad2d86
Move code for Clang to separate CMake module.
Bryan Dunsmore <dunsmoreb@gmail.com>
parents:
diff
changeset
|
10 |
# Check LLVM/Clang version |
8113
0ad9c42dca7c
Refactor Clang module.
Bryan Dunsmore <dunsmoreb@gmail.com>
parents:
8111
diff
changeset
|
11 |
if (CLANG_EXECUTABLE) |
0ad9c42dca7c
Refactor Clang module.
Bryan Dunsmore <dunsmoreb@gmail.com>
parents:
8111
diff
changeset
|
12 |
exec_program(${CLANG_EXECUTABLE} ARGS "-v" OUTPUT_VARIABLE CLANG_VERSION_FULL) |
8109
b5cd8cad2d86
Move code for Clang to separate CMake module.
Bryan Dunsmore <dunsmoreb@gmail.com>
parents:
diff
changeset
|
13 |
|
8113
0ad9c42dca7c
Refactor Clang module.
Bryan Dunsmore <dunsmoreb@gmail.com>
parents:
8111
diff
changeset
|
14 |
string(REGEX MATCH "[0-9]+\\.[0-9]+" CLANG_VERSION_LONG "${CLANG_VERSION_FULL}") |
0ad9c42dca7c
Refactor Clang module.
Bryan Dunsmore <dunsmoreb@gmail.com>
parents:
8111
diff
changeset
|
15 |
string(REGEX REPLACE "([0-9]+\\.[0-9]+)" "\\1" CLANG_VERSION "${CLANG_VERSION_LONG}") |
0ad9c42dca7c
Refactor Clang module.
Bryan Dunsmore <dunsmoreb@gmail.com>
parents:
8111
diff
changeset
|
16 |
else() |
0ad9c42dca7c
Refactor Clang module.
Bryan Dunsmore <dunsmoreb@gmail.com>
parents:
8111
diff
changeset
|
17 |
message(FATAL_ERROR "No LLVM/Clang compiler found (required for engine_c target)") |
0ad9c42dca7c
Refactor Clang module.
Bryan Dunsmore <dunsmoreb@gmail.com>
parents:
8111
diff
changeset
|
18 |
endif() |
8109
b5cd8cad2d86
Move code for Clang to separate CMake module.
Bryan Dunsmore <dunsmoreb@gmail.com>
parents:
diff
changeset
|
19 |
|
8113
0ad9c42dca7c
Refactor Clang module.
Bryan Dunsmore <dunsmoreb@gmail.com>
parents:
8111
diff
changeset
|
20 |
set(CMAKE_C_COMPILER ${CLANG_EXECUTABLE}) |