1 # get clang resource directory
4 # get_clang_resource_dir(out_var [PREFIX prefix] [SUBDIR subdirectory])
6 # user can use `PREFIX` to prepend some path to it or use `SUBDIR` to
7 # get subdirectory under clang resource dir
9 function(get_clang_resource_dir out_var)
10 cmake_parse_arguments(ARG "" "PREFIX;SUBDIR" "" ${ARGN})
12 if(DEFINED CLANG_RESOURCE_DIR AND NOT CLANG_RESOURCE_DIR STREQUAL "")
13 set(ret_dir bin/${CLANG_RESOURCE_DIR})
15 if (NOT CLANG_VERSION_MAJOR)
16 string(REGEX MATCH "^[0-9]+" CLANG_VERSION_MAJOR ${PACKAGE_VERSION})
18 set(ret_dir lib${LLVM_LIBDIR_SUFFIX}/clang/${CLANG_VERSION_MAJOR})
22 set(ret_dir ${ARG_PREFIX}/${ret_dir})
25 set(ret_dir ${ret_dir}/${ARG_SUBDIR})
28 set(${out_var} ${ret_dir} PARENT_SCOPE)