xref: /llvm-project/polly/unittests/CMakeLists.txt (revision c16538feb15ec1d8125192c782210d1a7eac63d7)
105cf9c22SMichael Kruseadd_custom_target(PollyUnitTests)
2*c16538feSMichael Kruseset_target_properties(PollyUnitTests PROPERTIES FOLDER "Polly/Tests")
305cf9c22SMichael Kruse
405cf9c22SMichael Kruse# add_polly_unittest(test_dirname file1.cpp file2.cpp)
505cf9c22SMichael Kruse#
605cf9c22SMichael Kruse# Will compile the list of files together and link against Polly and its dependences.
705cf9c22SMichael Krusefunction(add_polly_unittest test_name)
805cf9c22SMichael Kruse  if(COMMAND add_unittest)
905cf9c22SMichael Kruse    add_unittest(PollyUnitTests ${test_name} ${ARGN})
109c19d1f3SMichael Kruse  else()
119c19d1f3SMichael Kruse    add_executable(${test_name} EXCLUDE_FROM_ALL ${ARGN})
129c19d1f3SMichael Kruse    set_target_properties(${test_name} PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
139c19d1f3SMichael Kruse
14d806af34SShoaib Meenai    target_link_libraries(${test_name} PRIVATE gtest_main gtest)
159c19d1f3SMichael Kruse    add_dependencies(PollyUnitTests ${test_name})
169c19d1f3SMichael Kruse  endif()
17*c16538feSMichael Kruse  set_property(TARGET ${test_name} PROPERTY FOLDER "Polly/Tests/Unit")
18cdbc86ddSMichael Kruse
19cdbc86ddSMichael Kruse  if(LLVM_LINK_LLVM_DYLIB AND LLVM_POLLY_LINK_INTO_TOOLS)
20cdbc86ddSMichael Kruse    # In this case Polly is already present in libLLVM,
21cdbc86ddSMichael Kruse    # no need to link it again.
22cdbc86ddSMichael Kruse  else()
23d806af34SShoaib Meenai    target_link_libraries(${test_name} PRIVATE Polly)
24cdbc86ddSMichael Kruse  endif()
2505cf9c22SMichael Kruseendfunction()
2605cf9c22SMichael Kruse
2705cf9c22SMichael Kruseadd_subdirectory(Isl)
287886bd7cSMichael Kruseadd_subdirectory(Flatten)
29e23e94a0SMichael Kruseadd_subdirectory(DeLICM)
30483340bbSPhilip Pfaffeadd_subdirectory(ScopPassManager)
31feae3dfeSTobias Grosseradd_subdirectory(ScheduleOptimizer)
3252025af1SPhilip Pfaffeadd_subdirectory(Support)
33