Skip to content

Commit 2f2c91d

Browse files
committed
Same logic but try exposing the include directories as public
1 parent 963590e commit 2f2c91d

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

src/torchcodec/_core/CMakeLists.txt

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,14 +71,23 @@ function(make_torchcodec_sublibrary
7171
)
7272
endif()
7373

74-
# For the core library, use PRIVATE to prevent FFmpeg dependencies from leaking
75-
# For other libraries, use PUBLIC so they can properly link to their dependencies
74+
# For the core library, make dependencies PRIVATE to prevent transitive linking issues
75+
# but still expose include directories
7676
if(${library_name} MATCHES ".*_core[0-9]+$")
7777
target_link_libraries(
7878
${library_name}
7979
PRIVATE
8080
${library_dependencies}
8181
)
82+
# Manually expose FFmpeg include directories as PUBLIC for compilation
83+
foreach(dep ${library_dependencies})
84+
if(TARGET ${dep})
85+
get_target_property(dep_include_dirs ${dep} INTERFACE_INCLUDE_DIRECTORIES)
86+
if(dep_include_dirs)
87+
target_include_directories(${library_name} PUBLIC ${dep_include_dirs})
88+
endif()
89+
endif()
90+
endforeach()
8291
else()
8392
target_link_libraries(
8493
${library_name}

0 commit comments

Comments
 (0)