blob: b5c2cfbc28d9aa1c3451102e8bf3de2e1080f482 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
|
# - Find Clang library
# Find the native Clang includes and library
# This module defines
# CLANG_INCLUDE_DIRS, where to find AST/AST.h, Set when
# CLANG_INCLUDE_DIR is found.
# CLANG_LIBRARIES, libraries to link against to use Clang.
# CLANG_ROOT_DIR, The base directory to search for Clang.
# This can also be an environment variable.
# CLANG_FOUND, If false, do not try to use Clang.
#=============================================================================
# Copyright 2021 Blender Foundation.
#
# Distributed under the OSI-approved BSD 3-Clause License,
# see accompanying file BSD-3-Clause-license.txt for details.
#=============================================================================
# If CLANG_ROOT_DIR was defined in the environment, use it.
if(NOT CLANG_ROOT_DIR AND NOT $ENV{CLANG_ROOT_DIR} STREQUAL "")
set(CLANG_ROOT_DIR $ENV{CLANG_ROOT_DIR})
endif()
set(_CLANG_SEARCH_DIRS
${CLANG_ROOT_DIR}
/opt/lib/clang
)
find_path(CLANG_INCLUDE_DIR
NAMES
AST/AST.h
HINTS
${_CLANG_SEARCH_DIRS}
PATH_SUFFIXES
include
include/clang
)
set(_CLANG_FIND_COMPONENTS
clangDependencyScanning
clangDynamicASTMatchers
clangFrontendTool
clangStaticAnalyzerFrontend
clangHandleCXX
clangStaticAnalyzerCheckers
clangStaticAnalyzerCore
clangToolingASTDiff
clangToolingRefactoring
clangToolingSyntax
clangARCMigrate
clangCodeGen
clangCrossTU
clangIndex
clangTooling
clangFormat
clangToolingInclusions
clangRewriteFrontend
clangFrontend
clangSerialization
clangDriver
clangToolingCore
clangParse
clangRewrite
clangSema
clangEdit
clangAnalysis
clangASTMatchers
clangAST
clangLex
clangBasic
)
set(_CLANG_LIBRARIES)
foreach(COMPONENT ${_CLANG_FIND_COMPONENTS})
string(TOUPPER ${COMPONENT} UPPERCOMPONENT)
find_library(CLANG_${UPPERCOMPONENT}_LIBRARY
NAMES
${COMPONENT}
HINTS
${_CLANG_SEARCH_DIRS}
PATH_SUFFIXES
lib64 lib
)
list(APPEND _CLANG_LIBRARIES "${CLANG_${UPPERCOMPONENT}_LIBRARY}")
endforeach()
# Handle the QUIETLY and REQUIRED arguments and set CLANG_FOUND to TRUE if
# all listed variables are TRUE.
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(Clang DEFAULT_MSG
_CLANG_LIBRARIES CLANG_INCLUDE_DIR)
if(CLANG_FOUND)
set(CLANG_LIBRARIES ${_CLANG_LIBRARIES})
set(CLANG_INCLUDE_DIRS ${CLANG_INCLUDE_DIR})
endif()
mark_as_advanced(
CLANG_INCLUDE_DIR
)
foreach(COMPONENT ${_CLANG_FIND_COMPONENTS})
string(TOUPPER ${COMPONENT} UPPERCOMPONENT)
mark_as_advanced(CLANG_${UPPERCOMPONENT}_LIBRARY)
endforeach()
unset(_CLANG_SEARCH_DIRS)
unset(_CLANG_FIND_COMPONENTS)
unset(_CLANG_LIBRARIES)
|