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
This commit is contained in:
Douglas Gregor 2010-06-08 19:23:49 +00:00
parent 446872069f
commit 61b5ff5ab4
4 changed files with 14 additions and 21 deletions

View File

@ -41,6 +41,10 @@ if (CMAKE_COMPILER_IS_GNUCXX)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-common -Woverloaded-virtual -pedantic -Wno-long-long -Wall -W -Wno-unused-parameter -Wwrite-strings")
endif ()
if (APPLE)
set(CMAKE_MODULE_LINKER_FLAGS "-Wl,-flat_namespace -Wl,-undefined -Wl,suppress")
endif ()
macro(add_clang_library name)
set(srcs ${ARGN})
if(MSVC_IDE OR XCODE)
@ -54,7 +58,9 @@ macro(add_clang_library name)
../../include/clang${dir}/*.def)
set(srcs ${srcs} ${headers})
endif(MSVC_IDE OR XCODE)
if (SHARED_LIBRARY)
if (MODULE)
set(libkind MODULE)
elseif (SHARED_LIBRARY)
set(libkind SHARED)
else()
set(libkind)

View File

@ -1,26 +1,10 @@
set(SHARED_LIBRARY TRUE)
set(MODULE TRUE)
set(LLVM_NO_RTTI 1)
set(LLVM_USED_LIBS
clangIndex
clangFrontend
clangDriver
clangSema
clangAnalysis
clangAST
clangParse
clangLex
clangBasic)
set( LLVM_LINK_COMPONENTS
bitreader
mc
core
)
add_clang_library(PrintFunctionNames PrintFunctionNames.cpp)
set_target_properties(PrintFunctionNames
PROPERTIES
LINKER_LANGUAGE CXX)
LINKER_LANGUAGE CXX
PREFIX "")

View File

@ -18,8 +18,10 @@ set(LLVM_LINK_COMPONENTS
jit
interpreter
nativecodegen
asmparser
bitreader
bitwriter
codegen
ipo
selectiondag
)

View File

@ -3,8 +3,9 @@ set(SHARED_LIBRARY TRUE)
set(LLVM_NO_RTTI 1)
set(LLVM_USED_LIBS
clangFrontend
clangFrontend
clangDriver
clangCodeGen
clangSema
clangAnalysis
clangAST