mirror of
https://github.com/MaskRay/ccls.git
synced 2024-11-25 00:55:08 +00:00
Support override CLANG_RESOURCE_DIR
The result from clang commandline is something like /usr/lib/llvm-7/lib/clang/7.0.1 Which means I need to recompile when the clang is upgraded to newer 7.x.x However the system has a convenient symlink, which is /usr/include/clang/7.
This commit is contained in:
parent
17dc4a6ecc
commit
0eebe0c1a9
@ -120,22 +120,24 @@ endif()
|
|||||||
|
|
||||||
# Find Clang resource directory with Clang executable.
|
# Find Clang resource directory with Clang executable.
|
||||||
|
|
||||||
find_program(CLANG_EXECUTABLE clang)
|
if(NOT CLANG_RESOURCE_DIR)
|
||||||
if(NOT CLANG_EXECUTABLE)
|
find_program(CLANG_EXECUTABLE clang)
|
||||||
message(FATAL_ERROR "clang executable not found.")
|
if(NOT CLANG_EXECUTABLE)
|
||||||
endif()
|
message(FATAL_ERROR "clang executable not found.")
|
||||||
|
endif()
|
||||||
|
|
||||||
execute_process(
|
execute_process(
|
||||||
COMMAND ${CLANG_EXECUTABLE} -print-resource-dir
|
COMMAND ${CLANG_EXECUTABLE} -print-resource-dir
|
||||||
RESULT_VARIABLE CLANG_FIND_RESOURCE_DIR_RESULT
|
RESULT_VARIABLE CLANG_FIND_RESOURCE_DIR_RESULT
|
||||||
OUTPUT_VARIABLE CLANG_RESOURCE_DIR
|
OUTPUT_VARIABLE CLANG_RESOURCE_DIR
|
||||||
ERROR_VARIABLE CLANG_FIND_RESOURCE_DIR_ERROR
|
ERROR_VARIABLE CLANG_FIND_RESOURCE_DIR_ERROR
|
||||||
OUTPUT_STRIP_TRAILING_WHITESPACE
|
OUTPUT_STRIP_TRAILING_WHITESPACE
|
||||||
)
|
)
|
||||||
|
|
||||||
if(CLANG_FIND_RESOURCE_DIR_RESULT)
|
if(CLANG_FIND_RESOURCE_DIR_RESULT)
|
||||||
message(FATAL_ERROR "Error retrieving Clang resource directory with Clang \
|
message(FATAL_ERROR "Error retrieving Clang resource directory with Clang \
|
||||||
executable. Output:\n ${CLANG_FIND_RESOURCE_DIR_ERROR}")
|
executable. Output:\n ${CLANG_FIND_RESOURCE_DIR_ERROR}")
|
||||||
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
set_property(SOURCE src/utils.cc APPEND PROPERTY COMPILE_DEFINITIONS
|
set_property(SOURCE src/utils.cc APPEND PROPERTY COMPILE_DEFINITIONS
|
||||||
|
Loading…
Reference in New Issue
Block a user