Skip to content

Commit a4f83ff

Browse files
xsachafacebook-github-bot
authored andcommitted
Only look for Caffe2 package when shared (pytorch#18421)
Summary: Previously it would look for the Config even if it was not written. Fixed pytorch#18419 Pull Request resolved: pytorch#18421 Differential Revision: D14597139 Pulled By: ezyang fbshipit-source-id: c212cbf5dc91564c12d9d07e507c8285e11c6bdf
1 parent c297f26 commit a4f83ff

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

cmake/TorchConfig.cmake.in

+3-1
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,9 @@ else()
3636
endif()
3737

3838
# Library dependencies.
39-
find_package(Caffe2 REQUIRED PATHS ${CMAKE_CURRENT_LIST_DIR}/../Caffe2)
39+
if (@BUILD_SHARED_LIBS@)
40+
find_package(Caffe2 REQUIRED PATHS ${CMAKE_CURRENT_LIST_DIR}/../Caffe2)
41+
endif()
4042

4143
find_library(TORCH_LIBRARY torch PATHS "${TORCH_INSTALL_PREFIX}/lib")
4244
add_library(torch UNKNOWN IMPORTED)

0 commit comments

Comments
 (0)