Skip to content

Commit 96f420b

Browse files
authored
cmake: Find TBB dependency in Config.cmake.in when building static (#3557)
TBB::tbb is added as a library dependency via TARGET_NAME_IF_EXISTS. Therefore if an executable links OpenImageIO static library without the executable itself depending on TBB, then TBB will not be linked in and result in link time errors.
1 parent a2e7ec7 commit 96f420b

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

src/cmake/Config.cmake.in

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,11 @@ if (NOT @BUILD_SHARED_LIBS@)
2828
if (@PNG_FOUND@)
2929
find_dependency(PNG)
3030
endif()
31+
# The following have the same problem except that INTERFACE_LINK_LIBRARIES use
32+
# TARGET_NAME_IF_EXISTS, so the error only happens on link time.
33+
if (@OIIO_TBB@)
34+
find_dependency(TBB)
35+
endif ()
3136
endif ()
3237

3338
# Compute the installation prefix relative to this file. Note that cmake files are installed

0 commit comments

Comments
 (0)