From ba19f9a261332680e2b19fe1d1c46c2c6f33dfc5 Mon Sep 17 00:00:00 2001
From: jeremyd2019 <github@jdrake.com>
Date: Fri, 20 Aug 2021 12:06:11 -0700
Subject: [PATCH] handle clang libomp on Windows

---
 cmake/TulipUseFile.cmake | 18 ++++++++++++++----
 1 file changed, 14 insertions(+), 4 deletions(-)

diff --git a/cmake/TulipUseFile.cmake b/cmake/TulipUseFile.cmake
index 79da7ab616..b53a46643b 100644
--- a/cmake/TulipUseFile.cmake
+++ b/cmake/TulipUseFile.cmake
@@ -247,8 +247,13 @@ MACRO(TULIP_SET_COMPILER_OPTIONS)
               SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_RELWITHDEBINFO} /openmp")
               SET(OPENMP_CXX_FLAGS "/openmp")
             ELSE()
-              SET(CMAKE_CXX_STANDARD_LIBRARIES "${CMAKE_CXX_STANDARD_LIBRARIES} -lgomp ${CMAKE_THREAD_LIBS_INIT}")
-              SET(OPENMP_LIBRARIES "-lgomp -lpthread")
+              IF(CLANG)
+                SET(CMAKE_CXX_STANDARD_LIBRARIES "${CMAKE_CXX_STANDARD_LIBRARIES} -lomp ${CMAKE_THREAD_LIBS_INIT}")
+                SET(OPENMP_LIBRARIES "-lomp")
+              ELSE()
+                SET(CMAKE_CXX_STANDARD_LIBRARIES "${CMAKE_CXX_STANDARD_LIBRARIES} -lgomp ${CMAKE_THREAD_LIBS_INIT}")
+                SET(OPENMP_LIBRARIES "-lgomp -lpthread")
+              ENDIF()
             ENDIF()
           ENDIF()
         ELSE(OPENMP_FOUND)
@@ -262,8 +267,13 @@ MACRO(TULIP_SET_COMPILER_OPTIONS)
               IF(NOT MSVC)
                 SET(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} ${OpenMP_C_FLAGS}")
                 SET(OPENMP_LINKER_FLAGS "${OpenMP_C_FLAGS}")
-                SET(CMAKE_CXX_STANDARD_LIBRARIES "${CMAKE_CXX_STANDARD_LIBRARIES} -lgomp -lpthread")
-                SET(OPENMP_LIBRARIES "-lgomp -lpthread")
+                IF(CLANG)
+                  SET(CMAKE_CXX_STANDARD_LIBRARIES "${CMAKE_CXX_STANDARD_LIBRARIES} -lomp")
+                  SET(OPENMP_LIBRARIES "-lomp")
+                ELSE()
+                  SET(CMAKE_CXX_STANDARD_LIBRARIES "${CMAKE_CXX_STANDARD_LIBRARIES} -lgomp -lpthread")
+                  SET(OPENMP_LIBRARIES "-lgomp -lpthread")
+                ENDIF()
               ENDIF(NOT MSVC)
               SET(OPENMP_FOUND TRUE)
             ELSE(OMP_CFLAGS)
