summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--polly/CMakeLists.txt23
-rw-r--r--polly/cmake/polly_macros.cmake17
-rw-r--r--polly/lib/CMakeLists.txt4
3 files changed, 27 insertions, 17 deletions
diff --git a/polly/CMakeLists.txt b/polly/CMakeLists.txt
index b500246275e..a9e4732cbb9 100644
--- a/polly/CMakeLists.txt
+++ b/polly/CMakeLists.txt
@@ -82,15 +82,27 @@ set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${POLLY_SOURCE_DIR}/cmake")
SET(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)
FIND_PACKAGE(Isl REQUIRED)
+set(POLLY_LINK_LIBS ${ISL_LIBRARY})
+
FIND_PACKAGE(Pluto)
+if(PLUTO_FOUND)
+ set(POLLY_LINK_LIBS ${POLLY_LINK_LIBS} ${PLUTO_LIBRARY})
+endif(PLUTO_FOUND)
option(POLLY_USE_CLOOG "Build Polly with Cloog support" ON)
-if (POLLY_USE_CLOOG)
+if(POLLY_USE_CLOOG)
# Build Cloog support in Polly (default is for cloog-isl).
FIND_PACKAGE(Cloog)
FIND_PACKAGE(Gmp REQUIRED)
+ if(CLOOG_FOUND)
+ set(POLLY_LINK_LIBS ${POLLY_LINK_LIBS} ${CLOOG_LIBRARY})
+ endif(CLOOG_FOUND)
endif(POLLY_USE_CLOOG)
+if(GMP_FOUND)
+ set(POLLY_LINK_LIBS ${POLLY_LINK_LIBS} ${GMP_LIBRARY})
+endif(GMP_FOUND)
+
option(POLLY_ENABLE_GPGPU_CODEGEN "Enable GPGPU code generation feature" OFF)
if (POLLY_ENABLE_GPGPU_CODEGEN)
# Do not require CUDA, as GPU code generation test cases can be run without
@@ -102,11 +114,17 @@ endif(POLLY_ENABLE_GPGPU_CODEGEN)
option(POLLY_ENABLE_OPENSCOP "Enable Openscop library for scop import/export" ON)
if (POLLY_ENABLE_OPENSCOP)
FIND_PACKAGE(OpenScop)
+ if(OPENSCOP_FOUND)
+ set(POLLY_LINK_LIBS ${POLLY_LINK_LIBS} ${OPENSCOP_LIBRARY})
+ endif(OPENSCOP_FOUND)
endif(POLLY_ENABLE_OPENSCOP)
option(POLLY_ENABLE_SCOPLIB "Enable SCoPLib library for scop import/export" ON)
if (POLLY_ENABLE_SCOPLIB)
FIND_PACKAGE(SCoPLib)
+ if(SCOPLIB_FOUND)
+ set(POLLY_LINK_LIBS ${POLLY_LINK_LIBS} ${SCOPLIB_LIBRARY})
+ endif(SCOPLIB_FOUND)
endif(POLLY_ENABLE_SCOPLIB)
if (CLOOG_FOUND)
@@ -179,3 +197,6 @@ add_custom_command( OUTPUT formatting-update COMMAND
CLANG_FORMAT=${LLVM_BINARY_DIR}/bin/clang-format
${CMAKE_CURRENT_SOURCE_DIR}/utils/update_format.sh ${files})
add_custom_target(polly-update-format DEPENDS formatting-update)
+
+# Set the variable POLLY_LINK_LIBS in the llvm/tools/ dir.
+set(POLLY_LINK_LIBS ${POLLY_LINK_LIBS} PARENT_SCOPE)
diff --git a/polly/cmake/polly_macros.cmake b/polly/cmake/polly_macros.cmake
index 36a16a2f969..da65dcdf6b2 100644
--- a/polly/cmake/polly_macros.cmake
+++ b/polly/cmake/polly_macros.cmake
@@ -27,18 +27,11 @@ macro(add_polly_library name)
endforeach(lib)
endif( LLVM_USED_LIBS )
- target_link_libraries( ${name} ${ISL_LIBRARY})
-
- if (CLOOG_FOUND)
- target_link_libraries( ${name} ${CLOOG_LIBRARY} ${GMP_LIBRARY})
- endif(CLOOG_FOUND)
-
- if (OPENSCOP_FOUND)
- target_link_libraries( ${name} ${OPENSCOP_LIBRARY})
- endif(OPENSCOP_FOUND)
- if (SCOPLIB_FOUND)
- target_link_libraries( ${name} ${SCOPLIB_LIBRARY})
- endif(SCOPLIB_FOUND)
+ if(POLLY_LINK_LIBS)
+ foreach(lib ${POLLY_LINK_LIBS})
+ target_link_libraries(${name} ${lib})
+ endforeach(lib)
+ endif(POLLY_LINK_LIBS)
if( LLVM_LINK_COMPONENTS )
llvm_config(${name} ${LLVM_LINK_COMPONENTS})
diff --git a/polly/lib/CMakeLists.txt b/polly/lib/CMakeLists.txt
index 3e30c728765..571150ef585 100644
--- a/polly/lib/CMakeLists.txt
+++ b/polly/lib/CMakeLists.txt
@@ -89,7 +89,3 @@ set_target_properties(LLVMPolly
PROPERTIES
LINKER_LANGUAGE CXX
PREFIX "")
-
-if (PLUTO_FOUND)
- target_link_libraries(LLVMPolly ${PLUTO_LIBRARY})
-endif(PLUTO_FOUND)
OpenPOWER on IntegriCloud