diff --git a/openmp/libomptarget/CMakeLists.txt b/openmp/libomptarget/CMakeLists.txt --- a/openmp/libomptarget/CMakeLists.txt +++ b/openmp/libomptarget/CMakeLists.txt @@ -84,8 +84,15 @@ # Build offloading plugins and device RTLs if they are available. add_subdirectory(plugins) -add_subdirectory(DeviceRTL) add_subdirectory(tools) +set(LIBOMPTARGET_LLVM_VERSION "${LLVM_VERSION_MAJOR}.${LLVM_VERSION_MINOR}.${LLVM_VERSION_PATCH}") +if(CMAKE_CXX_COMPILER_ID MATCHES "Clang" AND CMAKE_CXX_COMPILER_VERSION VERSION_EQUAL LIBOMPTARGET_LLVM_VERSION) + add_subdirectory(DeviceRTL) +else() + libomptarget_say("Not building DeviceRTL, CMake compiler '${CMAKE_CXX_COMPILER} ${CMAKE_CXX_COMPILER_VERSION}' is not 'Clang ${LIBOMPTARGET_LLVM_VERSION}'.") + libomptarget_say(" Use the 'LLVM_ENABLE_RUNTIMES=openmp' option instead") +endif() + # Add tests. add_subdirectory(test)