OSDN Git Service

[OpenMP] Fixed an issue that wrong LLVM headers might be included when building libom...
authorShilei Tian <tianshilei1992@gmail.com>
Wed, 6 Jan 2021 22:07:17 +0000 (17:07 -0500)
committerShilei Tian <tianshilei1992@gmail.com>
Wed, 6 Jan 2021 22:07:36 +0000 (17:07 -0500)
Wrong LLVM headers might be included if we don't set `include_directories`
to a right place. This will cause a compilation error if LLVM is installed in
system directories.

Reviewed By: jdoerfert

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

openmp/libomptarget/src/CMakeLists.txt

index 35ff4ed..3fc7278 100644 (file)
@@ -21,6 +21,8 @@ set(LIBOMPTARGET_SRC_FILES
   ${CMAKE_CURRENT_SOURCE_DIR}/omptarget.cpp
 )
 
+include_directories(${LIBOMPTARGET_LLVM_MAIN_INCLUDE_DIR})
+
 # Build libomptarget library with libdl dependency. Add LLVMSupport
 # dependency if building in-tree with profiling enabled.
 if(OPENMP_STANDALONE_BUILD OR (NOT OPENMP_ENABLE_LIBOMPTARGET_PROFILING))