From: Sacha Date: Mon, 25 Mar 2019 14:21:37 +0000 (-0700) Subject: Only look for Caffe2 package when shared (#18421) X-Git-Tag: accepted/tizen/6.5/unified/20211028.231830~651 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=a4f83fff2b7fb0e7ca7b584648c98165b2576ed4;p=platform%2Fupstream%2Fpytorch.git Only look for Caffe2 package when shared (#18421) Summary: Previously it would look for the Config even if it was not written. Fixed #18419 Pull Request resolved: https://github.com/pytorch/pytorch/pull/18421 Differential Revision: D14597139 Pulled By: ezyang fbshipit-source-id: c212cbf5dc91564c12d9d07e507c8285e11c6bdf --- diff --git a/cmake/TorchConfig.cmake.in b/cmake/TorchConfig.cmake.in index 7329e5c..6222d71 100644 --- a/cmake/TorchConfig.cmake.in +++ b/cmake/TorchConfig.cmake.in @@ -36,7 +36,9 @@ else() endif() # Library dependencies. -find_package(Caffe2 REQUIRED PATHS ${CMAKE_CURRENT_LIST_DIR}/../Caffe2) +if (@BUILD_SHARED_LIBS@) + find_package(Caffe2 REQUIRED PATHS ${CMAKE_CURRENT_LIST_DIR}/../Caffe2) +endif() find_library(TORCH_LIBRARY torch PATHS "${TORCH_INSTALL_PREFIX}/lib") add_library(torch UNKNOWN IMPORTED)