2017-09-13 05:17:19 +01:00
|
|
|
# Copyright (c) 2016 Andrew Kelley
|
|
|
|
# This file is MIT licensed.
|
|
|
|
# See http://opensource.org/licenses/MIT
|
|
|
|
|
|
|
|
# CLANG_FOUND
|
|
|
|
# CLANG_INCLUDE_DIRS
|
|
|
|
# CLANG_LIBRARIES
|
2018-03-17 17:39:58 +00:00
|
|
|
# CLANG_LIBDIRS
|
2017-09-13 05:17:19 +01:00
|
|
|
|
2020-03-22 21:35:06 +00:00
|
|
|
find_path(CLANG_INCLUDE_DIRS NAMES clang/Frontend/ASTUnit.h
|
2022-07-16 02:51:41 +01:00
|
|
|
HINTS ${LLVM_INCLUDE_DIRS}
|
2022-07-25 18:29:38 +01:00
|
|
|
# Only look for Clang next to LLVM or in { CMAKE_PREFIX_PATH, CMAKE_LIBRARY_PATH, CMAKE_FRAMEWORK_PATH }
|
|
|
|
NO_SYSTEM_ENVIRONMENT_PATH
|
|
|
|
NO_CMAKE_SYSTEM_PATH
|
2020-04-10 03:28:53 +01:00
|
|
|
)
|
|
|
|
|
2022-07-16 02:51:41 +01:00
|
|
|
if(${LLVM_LINK_MODE} STREQUAL "shared")
|
2020-04-17 23:41:21 +01:00
|
|
|
find_library(CLANG_LIBRARIES
|
2020-04-10 03:28:53 +01:00
|
|
|
NAMES
|
2023-01-26 03:26:14 +00:00
|
|
|
libclang-cpp.so.16
|
|
|
|
clang-cpp-16.0
|
|
|
|
clang-cpp160
|
2020-04-10 03:28:53 +01:00
|
|
|
clang-cpp
|
2022-07-13 18:36:25 +01:00
|
|
|
NAMES_PER_DIR
|
2022-07-16 02:51:41 +01:00
|
|
|
HINTS "${LLVM_LIBDIRS}"
|
2022-07-25 18:29:38 +01:00
|
|
|
# Only look for Clang next to LLVM or in { CMAKE_PREFIX_PATH, CMAKE_LIBRARY_PATH, CMAKE_FRAMEWORK_PATH }
|
|
|
|
NO_SYSTEM_ENVIRONMENT_PATH
|
|
|
|
NO_CMAKE_SYSTEM_PATH
|
2020-04-10 03:28:53 +01:00
|
|
|
)
|
2022-07-16 02:51:41 +01:00
|
|
|
else()
|
2020-04-10 03:28:53 +01:00
|
|
|
macro(FIND_AND_ADD_CLANG_LIB _libname_)
|
2020-03-22 21:35:06 +00:00
|
|
|
string(TOUPPER ${_libname_} _prettylibname_)
|
2022-07-13 18:36:25 +01:00
|
|
|
find_library(CLANG_${_prettylibname_}_LIB NAMES ${_libname_} NAMES_PER_DIR
|
2022-07-16 02:51:41 +01:00
|
|
|
HINTS "${LLVM_LIBDIRS}"
|
2022-07-25 18:29:38 +01:00
|
|
|
# Only look for Clang next to LLVM or in { CMAKE_PREFIX_PATH, CMAKE_LIBRARY_PATH, CMAKE_FRAMEWORK_PATH }
|
|
|
|
NO_SYSTEM_ENVIRONMENT_PATH
|
|
|
|
NO_CMAKE_SYSTEM_PATH
|
2020-04-10 03:28:53 +01:00
|
|
|
)
|
2020-04-12 03:09:17 +01:00
|
|
|
if(CLANG_${_prettylibname_}_LIB)
|
|
|
|
set(CLANG_LIBRARIES ${CLANG_LIBRARIES} ${CLANG_${_prettylibname_}_LIB})
|
|
|
|
endif()
|
2020-04-10 03:28:53 +01:00
|
|
|
endmacro(FIND_AND_ADD_CLANG_LIB)
|
2020-03-22 21:35:06 +00:00
|
|
|
|
2020-04-10 03:28:53 +01:00
|
|
|
FIND_AND_ADD_CLANG_LIB(clangFrontendTool)
|
|
|
|
FIND_AND_ADD_CLANG_LIB(clangCodeGen)
|
|
|
|
FIND_AND_ADD_CLANG_LIB(clangFrontend)
|
|
|
|
FIND_AND_ADD_CLANG_LIB(clangDriver)
|
|
|
|
FIND_AND_ADD_CLANG_LIB(clangSerialization)
|
|
|
|
FIND_AND_ADD_CLANG_LIB(clangSema)
|
|
|
|
FIND_AND_ADD_CLANG_LIB(clangStaticAnalyzerFrontend)
|
|
|
|
FIND_AND_ADD_CLANG_LIB(clangStaticAnalyzerCheckers)
|
|
|
|
FIND_AND_ADD_CLANG_LIB(clangStaticAnalyzerCore)
|
|
|
|
FIND_AND_ADD_CLANG_LIB(clangAnalysis)
|
|
|
|
FIND_AND_ADD_CLANG_LIB(clangASTMatchers)
|
|
|
|
FIND_AND_ADD_CLANG_LIB(clangAST)
|
|
|
|
FIND_AND_ADD_CLANG_LIB(clangParse)
|
|
|
|
FIND_AND_ADD_CLANG_LIB(clangSema)
|
|
|
|
FIND_AND_ADD_CLANG_LIB(clangBasic)
|
|
|
|
FIND_AND_ADD_CLANG_LIB(clangEdit)
|
|
|
|
FIND_AND_ADD_CLANG_LIB(clangLex)
|
|
|
|
FIND_AND_ADD_CLANG_LIB(clangARCMigrate)
|
|
|
|
FIND_AND_ADD_CLANG_LIB(clangRewriteFrontend)
|
|
|
|
FIND_AND_ADD_CLANG_LIB(clangRewrite)
|
|
|
|
FIND_AND_ADD_CLANG_LIB(clangCrossTU)
|
|
|
|
FIND_AND_ADD_CLANG_LIB(clangIndex)
|
2020-07-25 01:08:39 +01:00
|
|
|
FIND_AND_ADD_CLANG_LIB(clangToolingCore)
|
2022-08-03 01:14:19 +01:00
|
|
|
FIND_AND_ADD_CLANG_LIB(clangExtractAPI)
|
|
|
|
FIND_AND_ADD_CLANG_LIB(clangSupport)
|
2020-04-10 03:28:53 +01:00
|
|
|
endif()
|
2017-09-13 05:17:19 +01:00
|
|
|
|
2022-11-08 07:14:39 +00:00
|
|
|
if (MSVC)
|
2023-01-04 07:18:51 +00:00
|
|
|
set(CLANG_LIBRARIES ${CLANG_LIBRARIES} "version.lib")
|
2022-11-08 07:14:39 +00:00
|
|
|
endif()
|
|
|
|
|
2017-09-13 05:17:19 +01:00
|
|
|
include(FindPackageHandleStandardArgs)
|
2020-03-25 22:43:28 +00:00
|
|
|
find_package_handle_standard_args(clang DEFAULT_MSG CLANG_LIBRARIES CLANG_INCLUDE_DIRS)
|
2017-09-13 05:17:19 +01:00
|
|
|
|
2018-03-17 17:39:58 +00:00
|
|
|
mark_as_advanced(CLANG_INCLUDE_DIRS CLANG_LIBRARIES CLANG_LIBDIRS)
|