diff Resources/CMake/OrthancStoneConfiguration.cmake @ 665:419e5662d7a5

fix
author Sebastien Jodogne <s.jodogne@gmail.com>
date Wed, 15 May 2019 12:28:58 +0200
parents 97926984d5d0
children e9339f2b5de7
line wrap: on
line diff
--- a/Resources/CMake/OrthancStoneConfiguration.cmake	Wed May 15 11:52:35 2019 +0200
+++ b/Resources/CMake/OrthancStoneConfiguration.cmake	Wed May 15 12:28:58 2019 +0200
@@ -146,13 +146,19 @@
 
 
 if (ENABLE_OPENGL)
-  include(FindOpenGL)
-  if (NOT OPENGL_FOUND)
-    message(FATAL_ERROR "Cannot find OpenGL on your system")
+  if (NOT CMAKE_SYSTEM_NAME STREQUAL "Emscripten")
+    # If including "FindOpenGL.cmake" using Emscripten (targetting
+    # WebAssembly), the "OPENGL_LIBRARIES" value incorrectly includes
+    # the "nul" library, which leads to warning message in Emscripten:
+    # 'shared:WARNING: emcc: cannot find library "nul"'.
+    include(FindOpenGL)
+    if (NOT OPENGL_FOUND)
+      message(FATAL_ERROR "Cannot find OpenGL on your system")
+    endif()
+
+    link_libraries(${OPENGL_LIBRARIES})
   endif()
 
-  link_libraries(${OPENGL_LIBRARIES})
-
   add_definitions(
     -DGL_GLEXT_PROTOTYPES=1
     -DORTHANC_ENABLE_OPENGL=1