cmake_modules/FindClang.cmake
branchwebgl
changeset 8113 0ad9c42dca7c
parent 8111 4307de8780fa
child 8450 404ddce27b23
equal deleted inserted replaced
8111:4307de8780fa 8113:0ad9c42dca7c
     1 # Load LLVM/Clang
     1 # Load LLVM/Clang
     2 IF (CLANG)
     2 if (CLANG)
     3     SET(CLANG_EXECUTABLE ${CLANG})
     3     set(CLANG_EXECUTABLE ${CLANG})
     4 ELSE()
     4 else()
     5     FIND_PROGRAM(CLANG_EXECUTABLE
     5     find_program(CLANG_EXECUTABLE
     6         NAMES clang-mp-3.2 clang-mp-3.1 clang-mp-3.0 clang
     6         NAMES clang-mp-3.2 clang-mp-3.1 clang-mp-3.0 clang
     7         PATHS /opt/local/bin /usr/local/bin /usr/bin)
     7         PATHS /opt/local/bin /usr/local/bin /usr/bin)
     8 ENDIF()
     8 endif()
     9 
     9 
    10 # Check LLVM/Clang version
    10 # Check LLVM/Clang version
    11 IF (CLANG_EXECUTABLE)
    11 if (CLANG_EXECUTABLE)
    12     EXEC_PROGRAM(${CLANG_EXECUTABLE} ARGS "-v" OUTPUT_VARIABLE CLANG_VERSION_FULL)
    12     exec_program(${CLANG_EXECUTABLE} ARGS "-v" OUTPUT_VARIABLE CLANG_VERSION_FULL)
    13 
    13 
    14     STRING(REGEX MATCH "[0-9]+\\.[0-9]+" CLANG_VERSION_LONG "${CLANG_VERSION_FULL}")
    14     string(REGEX MATCH "[0-9]+\\.[0-9]+" CLANG_VERSION_LONG "${CLANG_VERSION_FULL}")
    15     STRING(REGEX REPLACE "([0-9]+\\.[0-9]+)" "\\1" CLANG_VERSION "${CLANG_VERSION_LONG}")
    15     string(REGEX REPLACE "([0-9]+\\.[0-9]+)" "\\1" CLANG_VERSION "${CLANG_VERSION_LONG}")
    16 ELSE()
    16 else()
    17     MESSAGE(FATAL_ERROR "No LLVM/Clang compiler found (required for engine_c target)")
    17     message(FATAL_ERROR "No LLVM/Clang compiler found (required for engine_c target)")
    18 ENDIF()
    18 endif()
    19 
    19 
    20 SET(CMAKE_C_COMPILER ${CLANG_EXECUTABLE})
    20 set(CMAKE_C_COMPILER ${CLANG_EXECUTABLE})