Link LLVM libraries into libLLVMPolly if BUILD_SHARED_LIBS=ON is set

Without this change we get linker errors such as:

  undefined reference to `llvm::dbgs()'

We only conditionally link in these libraries, as in BUILD_SHARED_LIBS=OFF mode,
linking in these libraries causes such functions (and especially global options)
to be defined twice. The "solution" I choose is most likely not ideal, but seems
to work. If any cmake specialist can suggest a better approach, this would be
appreciated.

We also drop a .c file that is not needed as it caused linker errors as well.

llvm-svn: 228914
This commit is contained in:
Tobias Grosser 2015-02-12 08:27:19 +00:00
parent 24433a7005
commit cf33c93bd4
1 changed files with 12 additions and 1 deletions

View File

@ -91,7 +91,6 @@ set (ISL_FILES
External/isl/print.c
External/isl/imath/gmp_compat.c
External/isl/imath/imath.c
External/isl/imath/imdrover.c
External/isl/imath/imrat.c
External/isl/imath/iprime.c
External/isl/imath/pi.c
@ -129,6 +128,18 @@ add_polly_library(Polly
${ISL_FILES}
)
if (BUILD_SHARED_LIBS)
target_link_libraries(Polly
LLVMSupport
LLVMCore
LLVMScalarOpts
LLVMInstCombine
LLVMTransformUtils
LLVMAnalysis
LLVMipo
)
endif()
# Build a monolithic Polly.a and a thin module LLVMPolly.moduleext that links to
# that static library.
add_polly_loadable_module(LLVMPolly