Browse Source

note about png anomaly

Former-commit-id: 08e7f411ee9fdfe1591bf01c266b67adee8b4bc0
Alec Jacobson 7 years ago
parent
commit
5910b9824d
1 changed files with 11 additions and 6 deletions
  1. 11 6
      shared/cmake/libigl.cmake

+ 11 - 6
shared/cmake/libigl.cmake

@@ -310,13 +310,18 @@ endif()
 ################################################################################
 ################################################################################
 ### Compile the png parts ###
 ### Compile the png parts ###
 if(LIBIGL_WITH_PNG)
 if(LIBIGL_WITH_PNG)
-  set(STB_IMAGE_DIR "${LIBIGL_EXTERNAL}/stb_image")
-  if(NOT TARGET stb_image)
-    add_subdirectory("${STB_IMAGE_DIR}" "stb_image")
+  # png/ module is anomalous because it also depends on opengl it really should
+  # be moved into the opengl/ directory and namespace ...
+  if(TARGET igl_opengl)
+    set(STB_IMAGE_DIR "${LIBIGL_EXTERNAL}/stb_image")
+    if(NOT TARGET stb_image)
+      add_subdirectory("${STB_IMAGE_DIR}" "stb_image")
+    endif()
+    compile_igl_module("png" "")
+    target_link_libraries(igl_png ${IGL_SCOPE} igl_stb_image igl_opengl)
+  else()
+    set(LIBIGL_WITH_PNG OFF CACHE BOOL "" FORCE)
   endif()
   endif()
-  compile_igl_module("png")
-  target_link_libraries(igl_png ${IGL_SCOPE} igl_stb_image igl_opengl)
-  target_include_directories(igl_png SYSTEM ${IGL_SCOPE} ${STB_IMAGE_DIR})
 endif()
 endif()
 
 
 ################################################################################
 ################################################################################