Fix Polly
[polly-mirror.git] / cmake / PollyConfig.cmake.in
blob8b8a27c46616f59e88cbf69ee77eac0d21ca95ac
1 # This file allows users to call find_package(Polly) and pick up our targets.
3 find_package(LLVM REQUIRED CONFIG
4              HINTS "@POLLY_CONFIG_LLVM_CMAKE_DIR@")
6 set(Polly_CMAKE_DIR ${CMAKE_CURRENT_LIST_DIR})
7 set(Polly_BUNDLED_ISL @POLLY_BUNDLED_ISL@)
8 set(Polly_ENABLE_GPGPU_CODEGEN @POLLY_ENABLE_GPGPU_CODEGEN@)
10 set(Polly_DEFINITIONS ${LLVM_DEFINITIONS})
11 set(Polly_INCLUDE_DIRS @POLLY_CONFIG_INCLUDE_DIRS@ ${LLVM_INCLUDE_DIRS})
12 set(Polly_LIBRARY_DIRS @POLLY_CONFIG_LIBRARY_DIRS@)
13 set(Polly_EXPORTED_TARGETS @POLLY_CONFIG_EXPORTED_TARGETS@)
14 set(Polly_LIBRARIES ${LLVM_LIBRARIES} ${Polly_EXPORTED_TARGETS})
16 # Imported Targets:
17 @ISL_CONFIG_CODE@
19 if (Polly_ENABLE_GPGPU_CODEGEN AND NOT TARGET PollyPPCG)
20   add_library(PollyPPCG @POLLY_CONFIG_TARGET_PollyPPCG_TYPE@ IMPORTED)
21   set_property(TARGET PollyPPCG PROPERTY INTERFACE_LINK_LIBRARIES @ISL_TARGET@)
22 endif()
24 if (NOT TARGET Polly)
25   add_library(Polly @POLLY_CONFIG_TARGET_Polly_TYPE@ IMPORTED)
26   set_property(TARGET Polly PROPERTY INTERFACE_LINK_LIBRARIES @ISL_TARGET@)
27   if (Polly_ENABLE_GPGPU_CODEGEN)
28     set_property(TARGET Polly APPEND PROPERTY INTERFACE_LINK_LIBRARIES PollyPPCG)
29   endif()
30 endif()
32 if (NOT TARGET LLVMPolly)
33   add_library(LLVMPolly @POLLY_CONFIG_TARGET_LLVMPolly_TYPE@ IMPORTED)
34   set_property(TARGET LLVMPolly PROPERTY INTERFACE_LINK_LIBRARIES Polly)
35 endif()
37 # Exported locations:
38 file(GLOB CONFIG_FILES "${Polly_CMAKE_DIR}/PollyExports-*.cmake")
39 foreach(f ${CONFIG_FILES})
40   include(${f})
41 endforeach()