Skip to content
Snippets Groups Projects
Commit eb5dc498 authored by Douglas Gregor's avatar Douglas Gregor
Browse files

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.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@105630 91177308-0d34-0410-b5e6-96231b3b80d8
parent 45f5b54d
No related branches found
No related tags found
No related merge requests found
...@@ -41,6 +41,10 @@ if (CMAKE_COMPILER_IS_GNUCXX) ...@@ -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") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-common -Woverloaded-virtual -pedantic -Wno-long-long -Wall -W -Wno-unused-parameter -Wwrite-strings")
endif () endif ()
if (APPLE)
set(CMAKE_MODULE_LINKER_FLAGS "-Wl,-flat_namespace -Wl,-undefined -Wl,suppress")
endif ()
macro(add_clang_library name) macro(add_clang_library name)
set(srcs ${ARGN}) set(srcs ${ARGN})
if(MSVC_IDE OR XCODE) if(MSVC_IDE OR XCODE)
...@@ -54,7 +58,9 @@ macro(add_clang_library name) ...@@ -54,7 +58,9 @@ macro(add_clang_library name)
../../include/clang${dir}/*.def) ../../include/clang${dir}/*.def)
set(srcs ${srcs} ${headers}) set(srcs ${srcs} ${headers})
endif(MSVC_IDE OR XCODE) endif(MSVC_IDE OR XCODE)
if (SHARED_LIBRARY) if (MODULE)
set(libkind MODULE)
elseif (SHARED_LIBRARY)
set(libkind SHARED) set(libkind SHARED)
else() else()
set(libkind) set(libkind)
......
set(SHARED_LIBRARY TRUE) set(MODULE TRUE)
set(LLVM_NO_RTTI 1) 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) add_clang_library(PrintFunctionNames PrintFunctionNames.cpp)
set_target_properties(PrintFunctionNames set_target_properties(PrintFunctionNames
PROPERTIES PROPERTIES
LINKER_LANGUAGE CXX) LINKER_LANGUAGE CXX
PREFIX "")
...@@ -18,8 +18,10 @@ set(LLVM_LINK_COMPONENTS ...@@ -18,8 +18,10 @@ set(LLVM_LINK_COMPONENTS
jit jit
interpreter interpreter
nativecodegen nativecodegen
asmparser
bitreader bitreader
bitwriter bitwriter
codegen
ipo ipo
selectiondag selectiondag
) )
......
...@@ -3,8 +3,9 @@ set(SHARED_LIBRARY TRUE) ...@@ -3,8 +3,9 @@ set(SHARED_LIBRARY TRUE)
set(LLVM_NO_RTTI 1) set(LLVM_NO_RTTI 1)
set(LLVM_USED_LIBS set(LLVM_USED_LIBS
clangFrontend clangFrontend
clangDriver clangDriver
clangCodeGen
clangSema clangSema
clangAnalysis clangAnalysis
clangAST clangAST
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment