File tree Expand file tree Collapse file tree 3 files changed +9
-3
lines changed Expand file tree Collapse file tree 3 files changed +9
-3
lines changed Original file line number Diff line number Diff line change @@ -750,7 +750,9 @@ if(EXECUTORCH_BUILD_PYBIND)
750
750
endif ()
751
751
752
752
# find pytorch lib, to allow pybind to take at::Tensor as input/output
753
- find_package (Torch CONFIG REQUIRED )
753
+ if (NOT TARGET torch )
754
+ find_package (Torch CONFIG REQUIRED )
755
+ endif ()
754
756
find_library (
755
757
TORCH_PYTHON_LIBRARY torch_python PATHS "${TORCH_INSTALL_PREFIX} /lib"
756
758
)
Original file line number Diff line number Diff line change @@ -146,7 +146,9 @@ function(gen_custom_ops_aot_lib)
146
146
${_out_dir} /CustomOpsNativeFunctions.h "${GEN_KERNEL_SOURCES} "
147
147
)
148
148
# Find `Torch`.
149
- find_package (Torch REQUIRED )
149
+ if (NOT TARGET torch )
150
+ find_package (Torch REQUIRED )
151
+ endif ()
150
152
# This lib uses ATen lib, so we explicitly enable rtti and exceptions.
151
153
target_compile_options (${GEN_LIB_NAME} PRIVATE -frtti -fexceptions )
152
154
target_compile_definitions (${GEN_LIB_NAME} PRIVATE USE_ATEN_LIB=1 )
Original file line number Diff line number Diff line change @@ -69,7 +69,9 @@ install(TARGETS custom_ops DESTINATION lib)
69
69
70
70
if (EXECUTORCH_BUILD_KERNELS_CUSTOM_AOT )
71
71
# Add a AOT library
72
- find_package (Torch CONFIG REQUIRED )
72
+ if (NOT TARGET torch )
73
+ find_package (Torch CONFIG REQUIRED )
74
+ endif ()
73
75
add_library (
74
76
custom_ops_aot_lib SHARED
75
77
${_custom_ops__srcs}
You can’t perform that action at this time.
0 commit comments