MCPcopy Create free account
hub / github.com/pytorch/pytorch / _get_cmake_command

Method _get_cmake_command

tools/setup_helpers/cmake.py:53–78  ·  view source on GitHub ↗

Returns cmake command.

()

Source from the content-addressed store, hash-verified

51
52 @staticmethod
53 def _get_cmake_command() -> str:
54 "Returns cmake command."
55
56 cmake_command = "cmake"
57 if IS_WINDOWS:
58 return cmake_command
59 cmake3_version = CMake._get_version(which("cmake3"))
60 cmake_version = CMake._get_version(which("cmake"))
61
62 _cmake_min_version = LooseVersion("3.18.0")
63 if all(
64 ver is None or ver < _cmake_min_version
65 for ver in [cmake_version, cmake3_version]
66 ):
67 raise RuntimeError("no cmake or cmake3 with version >= 3.18.0 found")
68
69 if cmake3_version is None:
70 cmake_command = "cmake"
71 elif cmake_version is None:
72 cmake_command = "cmake3"
73 else:
74 if cmake3_version >= cmake_version:
75 cmake_command = "cmake3"
76 else:
77 cmake_command = "cmake"
78 return cmake_command
79
80 @staticmethod
81 def _get_version(cmd: Optional[str]) -> Any:

Callers 1

__init__Method · 0.80

Calls 3

whichFunction · 0.85
_get_versionMethod · 0.80
allFunction · 0.50

Tested by

no test coverage detected