Skip to content

Commit 1b6a1ea

Browse files
sunyabpixar-oss
authored andcommitted
cmake: Fix bug that caused oneTBB to not be found on Windows
The build system finds the TBB package via this call in Packages.cmake: find_package(TBB REQUIRED COMPONENTS tbb) On Windows oneTBB names its shared library "tbb12.dll" and "tbb12.lib". FindTBB.cmake was updated to try to accommodate this, but the way it was done required the component passed to find_package to be changed to "tbb12" instead of "tbb" on Windows. This change reverts that update and instead translates the "tbb" component to "tbb12" within FindTBB.cmake when it calls find_library to find the individual shared libraries for the package. This allows us to keep the find_package call unchanged. (Internal change: 2331094)
1 parent b6ac9b8 commit 1b6a1ea

1 file changed

Lines changed: 11 additions & 5 deletions

File tree

cmake/modules/FindTBB.cmake

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -224,22 +224,28 @@ if(NOT TBB_FOUND)
224224
endif()
225225

226226
if(TBB_VERSION VERSION_LESS 4.3)
227-
set(TBB_SEARCH_COMPOMPONENTS tbb_preview tbbmalloc ${_tbb_library_name})
227+
set(TBB_SEARCH_COMPOMPONENTS tbb_preview tbbmalloc tbb)
228228
else()
229-
set(TBB_SEARCH_COMPOMPONENTS tbb_preview tbbmalloc_proxy tbbmalloc ${_tbb_library_name})
229+
set(TBB_SEARCH_COMPOMPONENTS tbb_preview tbbmalloc_proxy tbbmalloc tbb)
230230
endif()
231231

232232
# Find each component
233233
foreach(_comp ${TBB_SEARCH_COMPOMPONENTS})
234-
if(";${TBB_FIND_COMPONENTS};" MATCHES ";${_comp};")
234+
if(";${TBB_FIND_COMPONENTS};tbb" MATCHES ";${_comp};")
235+
236+
if(${_comp} STREQUAL tbb)
237+
set(_lib_name ${_tbb_library_name})
238+
else()
239+
set(_lib_name ${_comp})
240+
endif()
235241

236242
# Search for the libraries
237-
find_library(TBB_${_comp}_LIBRARY_RELEASE ${_comp}
243+
find_library(TBB_${_comp}_LIBRARY_RELEASE ${_lib_name}
238244
HINTS ${TBB_LIBRARY} ${TBB_SEARCH_DIR}
239245
PATHS ${TBB_DEFAULT_SEARCH_DIR} ENV LIBRARY_PATH
240246
PATH_SUFFIXES ${TBB_LIB_PATH_SUFFIX})
241247

242-
find_library(TBB_${_comp}_LIBRARY_DEBUG ${_comp}_debug
248+
find_library(TBB_${_comp}_LIBRARY_DEBUG ${_lib_name}_debug
243249
HINTS ${TBB_LIBRARY} ${TBB_SEARCH_DIR}
244250
PATHS ${TBB_DEFAULT_SEARCH_DIR} ENV LIBRARY_PATH
245251
PATH_SUFFIXES ${TBB_LIB_PATH_SUFFIX})

0 commit comments

Comments
 (0)