Skip to content

Commit 4034dae

Browse files
pvijayakrishmc-nv
andauthored
Using find_library to verify Torchvision package
find_library() function in CMake is used to search for a library in specific directories and return its path if found. Co-authored-by: Misha Chornyi <[email protected]>
1 parent aff54e8 commit 4034dae

File tree

1 file changed

+4
-10
lines changed

1 file changed

+4
-10
lines changed

CMakeLists.txt

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -78,16 +78,10 @@ else()
7878
endif()
7979

8080
# Look for installed Torchvision package in lib paths
81-
if(TRITON_PYTORCH_ENABLE_TORCHVISION)
82-
if(${RHEL_BUILD})
83-
if(NOT EXISTS "${TRITON_PYTORCH_LIB_PATHS}/libtorchvision.so")
84-
message(WARNING "TRITON_PYTORCH_ENABLE_TORCHVISION is on, but TRITON_PYTORCH_LIB_PATHS does not contain Torchvision package")
85-
endif()
86-
else()
87-
if(NOT EXISTS "${TRITON_PYTORCH_LIB_PATHS}/libtorchvision.so.1")
88-
message(WARNING "TRITON_PYTORCH_ENABLE_TORCHVISION is on, but TRITON_PYTORCH_LIB_PATHS does not contain Torchvision package")
89-
endif()
90-
endif()
81+
find_library( LIBTORCHVISION libtorchvision.so libtorchvision.so.1 PATHS ${TRITON_PYTORCH_LIB_PATHS} )
82+
if(NOT ${LIBTORCHVISION})
83+
message(WARNING "TRITON_PYTORCH_ENABLE_TORCHVISION is on, but TRITON_PYTORCH_LIB_PATHS does not contain Torchvision package")
84+
endif(NOT ${LIBTORCHVISION})
9185
endif()
9286
endif()
9387

0 commit comments

Comments
 (0)