Always build glslang as static library

Change-Id: Id36b93fee4310023d8ab9524acf6e223a10f7a86
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/194929
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Jaswant Panchumarti <jaswant.panchumarti@kitware.com>
diff --git a/third_party/CMakeLists.txt b/third_party/CMakeLists.txt
index 89d3a33..2cea3b2 100644
--- a/third_party/CMakeLists.txt
+++ b/third_party/CMakeLists.txt
@@ -74,7 +74,12 @@
     set(SKIP_GLSLANG_INSTALL ON CACHE BOOL "" FORCE)
     set(ENABLE_OPT OFF CACHE BOOL "" FORCE)
     message(STATUS "Dawn: using GLSLang at ${DAWN_GLSLANG_DIR}")
+    # https://github.com/KhronosGroup/glslang/issues/2283
+    # glslang does not export symbols properly when BUILD_SHARED_LIBS=1, so always build it as static for now.
+    set(BUILD_SHARED_LIBS_SAVED ${BUILD_SHARED_LIBS})
+    set(BUILD_SHARED_LIBS 0)
     add_subdirectory("${DAWN_GLSLANG_DIR}" "${CMAKE_CURRENT_BINARY_DIR}/glslang" EXCLUDE_FROM_ALL)
+    set(BUILD_SHARED_LIBS ${BUILD_SHARED_LIBS_SAVED})
 endif()
 
 if (NOT TARGET glfw AND DAWN_USE_GLFW)