include_directories(
  ${CMAKE_SOURCE_DIR}/lib/Target/X86
  ${CMAKE_BINARY_DIR}/lib/Target/X86
  ${CMAKE_SOURCE_DIR}/tools/llvm-exegesis/lib
  )

set(LLVM_LINK_COMPONENTS
  MC
  MCParser
  Object
  Support
  Symbolize
  native
  )

add_llvm_unittest(LLVMExegesisTests
  BenchmarkResultTest.cpp
  InMemoryAssemblerTest.cpp
  InstructionSnippetGeneratorTest.cpp
  OperandGraphTest.cpp
  PerfHelperTest.cpp
  )
target_link_libraries(LLVMExegesisTests PRIVATE LLVMExegesis)

if(HAVE_LIBPFM)
  target_link_libraries(LLVMExegesisTests PRIVATE pfm)
endif()


include_directories(
  ${LLVM_MAIN_SRC_DIR}/lib/Target/X86
  ${LLVM_BINARY_DIR}/lib/Target/X86
  ${LLVM_MAIN_SRC_DIR}/tools/llvm-exegesis/lib
  )

set(LLVM_LINK_COMPONENTS
  MC
  MCParser
  Object
  Support
  Symbolize
  native
  )

add_llvm_unittest(LLVMExegesisTests
  BenchmarkResultTest.cpp
  InMemoryAssemblerTest.cpp
  InstructionSnippetGeneratorTest.cpp
  OperandGraphTest.cpp
  PerfHelperTest.cpp
  )
target_link_libraries(LLVMExegesisTests PRIVATE LLVMExegesis)

if(HAVE_LIBPFM)
  target_link_libraries(LLVMExegesisTests PRIVATE pfm)
endif()


Fix unittests include dirs when llvm is a part of another project
llvm-exegesis: Fix unittests include dirs when llvm is a part of another project

When llvm is a part of another project (i.e. opencl),
CMAKE_SOURCE_DIR and CMAKE_BINARY_DIR are pointing to
the parent project, which lead to build failures.

Differential Revision: https://reviews.llvm.org/D45328


git-svn-id: 0ff597fd157e6f4fc38580e8d64ab130330d2411@329325 91177308-0d34-0410-b5e6-96231b3b80d8
