 +# * TBB_VERSION           - The full version string
 +# * TBB_VERSION_MAJOR     - The major version
 +# * TBB_VERSION_MINOR     - The minor version
-+# * TBB_INTERFACE_VERSION - The interface version number defined in 
++# * TBB_INTERFACE_VERSION - The interface version number defined in
 +#                           tbb/tbb_stddef.h.
-+# * TBB_<library>_LIBRARY_RELEASE - The path of the TBB release version of 
++# * TBB_<library>_LIBRARY_RELEASE - The path of the TBB release version of
 +#                           <library>, where <library> may be tbb, tbb_debug,
-+#                           tbbmalloc, tbbmalloc_debug, tbb_preview, or 
++#                           tbbmalloc, tbbmalloc_debug, tbb_preview, or
 +#                           tbb_preview_debug.
-+# * TBB_<library>_LIBRARY_DEGUG - The path of the TBB release version of 
++# * TBB_<library>_LIBRARY_DEGUG - The path of the TBB release version of
 +#                           <library>, where <library> may be tbb, tbb_debug,
-+#                           tbbmalloc, tbbmalloc_debug, tbb_preview, or 
++#                           tbbmalloc, tbbmalloc_debug, tbb_preview, or
 +#                           tbb_preview_debug.
 +#
 +# The following varibles should be used to build and link with TBB:

-        # Extract the directory and apply the matched text (in brackets)
-        get_filename_component(Tbb_${COMPONENT}_DIR "${Tbb_${COMPONENT}_LIBRARY}" DIRECTORY)
-        set(Tbb_${COMPONENT}_LIBRARY "${Tbb_${COMPONENT}_DIR}/${CMAKE_MATCH_1}")
+      if(TBB_${_comp}_LIBRARY AND EXISTS "${TBB_${_comp}_LIBRARY}")
+        set(TBB_${_comp}_FOUND TRUE)
+      else()
+        set(TBB_${_comp}_FOUND FALSE)
       endif()
+
+      # Mark internal variables as advanced
+      mark_as_advanced(TBB_${_comp}_LIBRARY_RELEASE)
+      mark_as_advanced(TBB_${_comp}_LIBRARY_DEBUG)
+      mark_as_advanced(TBB_${_comp}_LIBRARY)
+
     endif()
-  endif()
+  endforeach()
 
-  list(APPEND Tbb_LIB_COMPONENTS ${Tbb_${COMPONENT}_LIBRARY})
+  ##################################
+  # Set compile flags and libraries
+  ##################################
 
-  if(Tbb_${COMPONENT}_LIBRARY)
-    set(TBB_${COMPONENT}_FOUND TRUE)
-  else()
-    set(TBB_${COMPONENT}_FOUND FALSE)
+  set(TBB_DEFINITIONS_RELEASE "")
+  set(TBB_DEFINITIONS_DEBUG "TBB_USE_DEBUG=1")
+    
+  if(TBB_LIBRARIES_${TBB_BUILD_TYPE})
+    set(TBB_LIBRARIES "${TBB_LIBRARIES_${TBB_BUILD_TYPE}}")
+  endif()
+  
+  if(NOT MSVC AND NOT TBB_LIBRARIES)
+    set(TBB_LIBRARIES ${TBB_LIBRARIES_RELEASE})
   endif()
-endforeach()
 
-if(UNIX AND TBB_USE_STATIC_LIBS)
-  set(CMAKE_FIND_LIBRARY_SUFFIXES ${_TBB_ORIG_CMAKE_FIND_LIBRARY_SUFFIXES})
-  unset(_TBB_ORIG_CMAKE_FIND_LIBRARY_SUFFIXES)
-endif()
+  set(TBB_DEFINITIONS "")
+  if (MSVC AND TBB_STATIC)
+    set(TBB_DEFINITIONS __TBB_NO_IMPLICIT_LINKAGE)

From c660786dbac9e4c284049af4da56c34a998a4b68 Mon Sep 17 00:00:00 2001
From: tamasmeszaros <meszaros.q@gmail.com>
Date: Thu, 23 Jan 2020 16:27:21 +0100
Subject: [PATCH] openvdb-mods

---
 CMakeLists.txt                  |   3 -
 cmake/CheckAtomic.cmake         | 106 ++++++
 cmake/FindBlosc.cmake           | 218 ------------
 cmake/FindCppUnit.cmake         |   4 +-
 cmake/FindIlmBase.cmake         | 337 ------------------
 cmake/FindOpenEXR.cmake         | 329 ------------------
 cmake/FindOpenVDB.cmake         |  19 +-
 cmake/FindTBB.cmake             | 599 ++++++++++++++++----------------
 openvdb/CMakeLists.txt          |  13 +-
 openvdb/Grid.cc                 |   3 +
 openvdb/PlatformConfig.h        |   9 +-
 openvdb/cmd/CMakeLists.txt      |  11 +-
 openvdb/unittest/CMakeLists.txt |   3 +-
 openvdb/unittest/TestFile.cc    |   2 +-
 14 files changed, 446 insertions(+), 1210 deletions(-)
 create mode 100644 cmake/CheckAtomic.cmake
 delete mode 100644 cmake/FindBlosc.cmake
 delete mode 100644 cmake/FindIlmBase.cmake
 delete mode 100644 cmake/FindOpenEXR.cmake
