@@ -177,16 +177,6 @@ if(EXISTS "${_executorch_version_file}")
177177endif ()
178178unset (_executorch_version_file)
179179
180- # Where the shipped libraries live. Computed here rather than beside the Python
181- # extension, because a consumer on the older variables route is told to put this
182- # in its INSTALL_RPATH, and a package built without that extension would
183- # otherwise hand it an empty string and produce a binary that cannot start.
184- if (_executorch_runtime_library)
185- get_filename_component (
186- EXECUTORCH_RUNTIME_LIBRARY_DIR "${_executorch_runtime_library} " DIRECTORY
187- )
188- endif ()
189-
190180set (EXECUTORCH_INCLUDE_DIRS "${_executorch_package_root} /include"
191181 "${_executorch_c10_include} "
192182)
@@ -263,6 +253,16 @@ endfunction()
263253
264254# The prebuilt runtime.
265255_executorch_find_library (_executorch_runtime_library libexecutorch )
256+
257+ # Computed after the lookup above rather than beside the Python extension,
258+ # because a consumer on the older variables route is told to put this in its
259+ # INSTALL_RPATH, and reading it before the runtime library is found handed that
260+ # consumer an empty string.
261+ if (_executorch_runtime_library)
262+ get_filename_component (
263+ EXECUTORCH_RUNTIME_LIBRARY_DIR "${_executorch_runtime_library} " DIRECTORY
264+ )
265+ endif ()
266266if (_executorch_runtime_library AND NOT _executorch_targets_supported)
267267 # The imported targets are skipped, but the libraries themselves are present
268268 # and linkable by path, so the long-standing variables are still honoured.
0 commit comments