diff --git a/openmp/CMakeLists.txt b/openmp/CMakeLists.txt --- a/openmp/CMakeLists.txt +++ b/openmp/CMakeLists.txt @@ -66,6 +66,11 @@ set(ENABLE_LIBOMPTARGET OFF) endif() +if (NOT LLVM_MAIN_INCLUDE_DIR) + message(STATUS "Missing definition for LLVM_MAIN_INCLUDE_DIR, disabling libomptarget") + set(ENABLE_LIBOMPTARGET OFF) +endif() + option(OPENMP_ENABLE_LIBOMPTARGET "Enable building libomptarget for offloading." ${ENABLE_LIBOMPTARGET}) if (OPENMP_ENABLE_LIBOMPTARGET) diff --git a/openmp/libomptarget/CMakeLists.txt b/openmp/libomptarget/CMakeLists.txt --- a/openmp/libomptarget/CMakeLists.txt +++ b/openmp/libomptarget/CMakeLists.txt @@ -29,6 +29,11 @@ # Get dependencies for the different components of the project. include(LibomptargetGetDependencies) +# LLVM source tree is required at build time for libomptarget +if (NOT LLVM_MAIN_INCLUDE_DIR) + message(FATAL_ERROR "Missing definition for LLVM_MAIN_INCLUDE_DIR") +endif() + # This is a list of all the targets that are supported/tested right now. set (LIBOMPTARGET_ALL_TARGETS "${LIBOMPTARGET_ALL_TARGETS} aarch64-unknown-linux-gnu") set (LIBOMPTARGET_ALL_TARGETS "${LIBOMPTARGET_ALL_TARGETS} powerpc64le-ibm-linux-gnu")