Skip to content

Commit 778fb1b

Browse files
committed
Update
[ghstack-poisoned]
1 parent a5dbcc5 commit 778fb1b

File tree

1 file changed

+12
-10
lines changed

1 file changed

+12
-10
lines changed

build/Utils.cmake

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -353,11 +353,11 @@ function(add_torch_to_cmake_prefix_path)
353353
resolve_python_executable()
354354
endif()
355355
execute_process(
356-
COMMAND "${PYTHON_EXECUTABLE}" -c "import torch as _; print(_.__path__[0], end='')"
356+
COMMAND "${PYTHON_EXECUTABLE}" -c
357+
"import torch as _; print(_.__path__[0], end='')"
357358
OUTPUT_VARIABLE _tmp_torch_path
358359
ERROR_VARIABLE _tmp_torch_path_error
359-
RESULT_VARIABLE _tmp_torch_path_result
360-
COMMAND_ECHO STDERR
360+
RESULT_VARIABLE _tmp_torch_path_result COMMAND_ECHO STDERR
361361
OUTPUT_STRIP_TRAILING_WHITESPACE
362362
)
363363
if(NOT _tmp_torch_path_result EQUAL 0)
@@ -368,16 +368,18 @@ function(add_torch_to_cmake_prefix_path)
368368
message(FATAL_ERROR "Error:\n${_tmp_torch_path_error}")
369369
endif()
370370
list(APPEND CMAKE_PREFIX_PATH "${_tmp_torch_path}")
371-
set(CMAKE_PREFIX_PATH "${CMAKE_PREFIX_PATH}" PARENT_SCOPE)
371+
set(CMAKE_PREFIX_PATH
372+
"${CMAKE_PREFIX_PATH}"
373+
PARENT_SCOPE
374+
)
372375
endfunction()
373376

374-
# Replacement for find_package(Torch CONFIG REQUIRED); sets up
375-
# CMAKE_PREFIX_PATH first and only does the find once. If you have a
376-
# header-only Torch dependency, use find_package_torch_headers
377-
# instead!
378-
function(find_package_torch)
377+
# Replacement for find_package(Torch CONFIG REQUIRED); sets up CMAKE_PREFIX_PATH
378+
# first and only does the find once. If you have a header-only Torch dependency,
379+
# use find_package_torch_headers instead!
380+
macro(find_package_torch)
379381
if(NOT TARGET torch)
380382
add_torch_to_cmake_prefix_path()
381383
find_package(Torch CONFIG REQUIRED)
382384
endif()
383-
endfunction()
385+
endmacro()

0 commit comments

Comments
 (0)