Skip to content

Commit 61b5ff5

Browse files
committed
Teach the PrintFunctionNames example to be a proper module, so that
Clang can load it as a plugin. Original fix by Troy D. Straszheim, which I extended with Darwin support. Fixes PR6801. llvm-svn: 105630
1 parent 4468720 commit 61b5ff5

File tree

4 files changed

+14
-21
lines changed

4 files changed

+14
-21
lines changed

clang/CMakeLists.txt

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,10 @@ if (CMAKE_COMPILER_IS_GNUCXX)
4141
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-common -Woverloaded-virtual -pedantic -Wno-long-long -Wall -W -Wno-unused-parameter -Wwrite-strings")
4242
endif ()
4343

44+
if (APPLE)
45+
set(CMAKE_MODULE_LINKER_FLAGS "-Wl,-flat_namespace -Wl,-undefined -Wl,suppress")
46+
endif ()
47+
4448
macro(add_clang_library name)
4549
set(srcs ${ARGN})
4650
if(MSVC_IDE OR XCODE)
@@ -54,7 +58,9 @@ macro(add_clang_library name)
5458
../../include/clang${dir}/*.def)
5559
set(srcs ${srcs} ${headers})
5660
endif(MSVC_IDE OR XCODE)
57-
if (SHARED_LIBRARY)
61+
if (MODULE)
62+
set(libkind MODULE)
63+
elseif (SHARED_LIBRARY)
5864
set(libkind SHARED)
5965
else()
6066
set(libkind)
Lines changed: 3 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,10 @@
1-
set(SHARED_LIBRARY TRUE)
1+
set(MODULE TRUE)
22

33
set(LLVM_NO_RTTI 1)
44

5-
set(LLVM_USED_LIBS
6-
clangIndex
7-
clangFrontend
8-
clangDriver
9-
clangSema
10-
clangAnalysis
11-
clangAST
12-
clangParse
13-
clangLex
14-
clangBasic)
15-
16-
set( LLVM_LINK_COMPONENTS
17-
bitreader
18-
mc
19-
core
20-
)
21-
225
add_clang_library(PrintFunctionNames PrintFunctionNames.cpp)
236

247
set_target_properties(PrintFunctionNames
258
PROPERTIES
26-
LINKER_LANGUAGE CXX)
9+
LINKER_LANGUAGE CXX
10+
PREFIX "")

clang/examples/clang-interpreter/CMakeLists.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,10 @@ set(LLVM_LINK_COMPONENTS
1818
jit
1919
interpreter
2020
nativecodegen
21+
asmparser
2122
bitreader
2223
bitwriter
24+
codegen
2325
ipo
2426
selectiondag
2527
)

clang/tools/libclang/CMakeLists.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,9 @@ set(SHARED_LIBRARY TRUE)
33
set(LLVM_NO_RTTI 1)
44

55
set(LLVM_USED_LIBS
6-
clangFrontend
6+
clangFrontend
77
clangDriver
8+
clangCodeGen
89
clangSema
910
clangAnalysis
1011
clangAST

0 commit comments

Comments
 (0)