2017-09-12 21:17:19 -07: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 10:39:58 -07:00
|
|
|
# CLANG_LIBDIRS
|
2017-09-12 21:17:19 -07:00
|
|
|
|
|
|
|
if(MSVC)
|
|
|
|
find_package(CLANG REQUIRED CONFIG)
|
|
|
|
|
|
|
|
set(CLANG_LIBRARIES
|
2019-02-24 09:53:28 -08:00
|
|
|
clangFrontendTool
|
|
|
|
clangCodeGen
|
2017-09-12 21:17:19 -07:00
|
|
|
clangFrontend
|
|
|
|
clangDriver
|
|
|
|
clangSerialization
|
|
|
|
clangSema
|
2019-02-24 09:53:28 -08:00
|
|
|
clangStaticAnalyzerFrontend
|
|
|
|
clangStaticAnalyzerCheckers
|
|
|
|
clangStaticAnalyzerCore
|
2017-09-12 21:17:19 -07:00
|
|
|
clangAnalysis
|
2019-02-24 09:53:28 -08:00
|
|
|
clangASTMatchers
|
2017-09-12 21:17:19 -07:00
|
|
|
clangAST
|
|
|
|
clangParse
|
|
|
|
clangSema
|
|
|
|
clangBasic
|
|
|
|
clangEdit
|
|
|
|
clangLex
|
2019-02-24 09:53:28 -08:00
|
|
|
clangARCMigrate
|
|
|
|
clangRewriteFrontend
|
|
|
|
clangRewrite
|
|
|
|
clangCrossTU
|
|
|
|
clangIndex
|
2017-09-12 21:17:19 -07:00
|
|
|
)
|
|
|
|
|
|
|
|
else()
|
|
|
|
find_path(CLANG_INCLUDE_DIRS NAMES clang/Frontend/ASTUnit.h
|
|
|
|
PATHS
|
2018-09-19 14:34:52 -07:00
|
|
|
/usr/lib/llvm/8/include
|
|
|
|
/usr/lib/llvm-8/include
|
|
|
|
/usr/lib/llvm-8.0/include
|
2018-12-23 14:04:26 -08:00
|
|
|
/usr/local/llvm80/include
|
2017-09-12 21:17:19 -07:00
|
|
|
/mingw64/include)
|
|
|
|
|
|
|
|
macro(FIND_AND_ADD_CLANG_LIB _libname_)
|
|
|
|
string(TOUPPER ${_libname_} _prettylibname_)
|
|
|
|
find_library(CLANG_${_prettylibname_}_LIB NAMES ${_libname_}
|
|
|
|
PATHS
|
2018-03-17 10:39:58 -07:00
|
|
|
${CLANG_LIBDIRS}
|
2018-09-19 14:34:52 -07:00
|
|
|
/usr/lib/llvm/8/lib
|
|
|
|
/usr/lib/llvm-8/lib
|
|
|
|
/usr/lib/llvm-8.0/lib
|
2018-12-23 14:04:26 -08:00
|
|
|
/usr/local/llvm80/lib
|
2017-09-12 21:17:19 -07:00
|
|
|
/mingw64/lib
|
|
|
|
/c/msys64/mingw64/lib
|
|
|
|
c:\\msys64\\mingw64\\lib)
|
|
|
|
if(CLANG_${_prettylibname_}_LIB)
|
|
|
|
set(CLANG_LIBRARIES ${CLANG_LIBRARIES} ${CLANG_${_prettylibname_}_LIB})
|
|
|
|
endif()
|
|
|
|
endmacro(FIND_AND_ADD_CLANG_LIB)
|
|
|
|
|
2019-02-24 09:53:28 -08:00
|
|
|
FIND_AND_ADD_CLANG_LIB(clangFrontendTool)
|
|
|
|
FIND_AND_ADD_CLANG_LIB(clangCodeGen)
|
2017-09-12 21:17:19 -07:00
|
|
|
FIND_AND_ADD_CLANG_LIB(clangFrontend)
|
|
|
|
FIND_AND_ADD_CLANG_LIB(clangDriver)
|
|
|
|
FIND_AND_ADD_CLANG_LIB(clangSerialization)
|
|
|
|
FIND_AND_ADD_CLANG_LIB(clangSema)
|
2019-02-24 09:53:28 -08:00
|
|
|
FIND_AND_ADD_CLANG_LIB(clangStaticAnalyzerFrontend)
|
|
|
|
FIND_AND_ADD_CLANG_LIB(clangStaticAnalyzerCheckers)
|
|
|
|
FIND_AND_ADD_CLANG_LIB(clangStaticAnalyzerCore)
|
2017-09-12 21:17:19 -07:00
|
|
|
FIND_AND_ADD_CLANG_LIB(clangAnalysis)
|
2019-02-24 09:53:28 -08:00
|
|
|
FIND_AND_ADD_CLANG_LIB(clangASTMatchers)
|
2017-09-12 21:17:19 -07:00
|
|
|
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)
|
2019-02-24 09:53:28 -08:00
|
|
|
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)
|
2017-09-12 21:17:19 -07:00
|
|
|
endif()
|
|
|
|
|
|
|
|
include(FindPackageHandleStandardArgs)
|
|
|
|
find_package_handle_standard_args(CLANG DEFAULT_MSG CLANG_LIBRARIES CLANG_INCLUDE_DIRS)
|
|
|
|
|
2018-03-17 10:39:58 -07:00
|
|
|
mark_as_advanced(CLANG_INCLUDE_DIRS CLANG_LIBRARIES CLANG_LIBDIRS)
|