From f7eed34cab72eeb46ffa84465c13684b7afcd59b Mon Sep 17 00:00:00 2001
From: Yifan Zhao <yifanz16@illinois.edu>
Date: Mon, 11 Jan 2021 15:11:25 -0600
Subject: [PATCH] Added compiler version check

---
 hpvm/projects/hpvm-tensor-rt/CMakeLists.txt | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/hpvm/projects/hpvm-tensor-rt/CMakeLists.txt b/hpvm/projects/hpvm-tensor-rt/CMakeLists.txt
index a04dd2a9c8..81490cce66 100644
--- a/hpvm/projects/hpvm-tensor-rt/CMakeLists.txt
+++ b/hpvm/projects/hpvm-tensor-rt/CMakeLists.txt
@@ -4,6 +4,18 @@ find_package(CUDA 6.5 REQUIRED)
 set(CUDA_SEPARABLE_COMPILATION ON CACHE BOOL "")
 set(CUDA_PROPAGATE_HOST_FLAGS OFF)
 
+if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
+  # gcc > 8 are not supported
+  if (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER 8)
+    message(FATAL_ERROR "GCC versions later than 8 are not supported")
+  endif()
+elseif("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
+  # clang < 3.2 || clang >= 9 unsupported
+  set(clang_v ${CMAKE_CXX_COMPILER_VERSION})
+  if (clang_v VERSION_GREATER_EQUAL 9 OR clang_v VERSION_LESS_EQUAL 3.2)
+    message(FATAL_ERROR "Clang<3.2 or clang>=9 are not supported")
+  endif()
+endif()
 # Addresses a bug where code is not compiled as C++11 in non-CUDA code and older g++ versions
 # Edit: using c++14 now
 set(CMAKE_CXX_STANDARD 14)
-- 
GitLab