[polly] r228914 - Link LLVM libraries into libLLVMPolly if BUILD_SHARED_LIBS=ON is set

Tobias Grosser tobias at grosser.es
Thu Feb 12 00:27:19 PST 2015


Author: grosser
Date: Thu Feb 12 02:27:19 2015
New Revision: 228914

URL: http://llvm.org/viewvc/llvm-project?rev=228914&view=rev
Log:
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.

Modified:
    polly/trunk/lib/CMakeLists.txt

Modified: polly/trunk/lib/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/polly/trunk/lib/CMakeLists.txt?rev=228914&r1=228913&r2=228914&view=diff
==============================================================================
--- polly/trunk/lib/CMakeLists.txt (original)
+++ polly/trunk/lib/CMakeLists.txt Thu Feb 12 02:27:19 2015
@@ -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





More information about the llvm-commits mailing list