Warning, /kdevelop/kdevelop/plugins/clang/Locate_CLANG_BUILTIN_DIR.cmake is written in an unsupported language. File is not indexed.

0001 set(CLANG_VERSION "${LLVM_PACKAGE_VERSION}")
0002 set(CLANG_VERSION_MAJOR "${LLVM_VERSION_MAJOR}")
0003 
0004 # Since https://github.com/llvm/llvm-project/commit/e1b88c8a09be25b86b13f98755a9bd744b4dbf14
0005 # Clang's resource directory includes only the major version.
0006 if (CLANG_VERSION_MAJOR GREATER_EQUAL 16)
0007     set(CLANG_VERSION_SUBDIR "${CLANG_VERSION_MAJOR}")
0008 else()
0009     # Git version of Clang ends with the "git" suffix, e.g. "14.0.0git", but
0010     # installs builtin headers into a subdirectory without the suffix, e.g. "14.0.0".
0011     string(REPLACE "git" "" CLANG_VERSION_SUBDIR "${CLANG_VERSION}")
0012 endif()
0013 
0014 message(STATUS "  LLVM library directories:   ${LLVM_LIBRARY_DIRS}")
0015 message(STATUS "  Clang include directories:  ${CLANG_INCLUDE_DIRS}")
0016 
0017 find_path(CLANG_BUILTIN_DIR
0018     # cpuid.h because it is defined in ClangSupport constructor as valid clang builtin dir indicator
0019     NAMES "cpuid.h"
0020     PATHS   "${LLVM_LIBRARY_DIRS}"
0021             "${CLANG_INCLUDE_DIRS}"
0022     PATH_SUFFIXES   "clang/${CLANG_VERSION_SUBDIR}/include"
0023                     "../lib/clang/${CLANG_VERSION_SUBDIR}/include"
0024                     "../../../clang/${CLANG_VERSION_SUBDIR}/include"
0025     NO_DEFAULT_PATH
0026 )
0027 
0028 if (NOT CLANG_BUILTIN_DIR)
0029     message(FATAL_ERROR "Could not find Clang builtin include directory")
0030 endif()
0031 get_filename_component(CLANG_BUILTIN_DIR "${CLANG_BUILTIN_DIR}" ABSOLUTE)
0032 
0033 message(STATUS "  Builtin include directory:  ${CLANG_BUILTIN_DIR}")