depot/pkgs/development/libraries/onnxruntime/0001-eigen-allow-dependency-injection.patch
Luke Granger-Brown 57725ef3ec Squashed 'third_party/nixpkgs/' content from commit 76612b17c0ce
git-subtree-dir: third_party/nixpkgs
git-subtree-split: 76612b17c0ce71689921ca12d9ffdc9c23ce40b2
2024-11-10 23:59:47 +00:00

20 lines
738 B
Diff

diff --git a/cmake/external/eigen.cmake b/cmake/external/eigen.cmake
index b123adb..aab2483 100644
--- a/cmake/external/eigen.cmake
+++ b/cmake/external/eigen.cmake
@@ -7,8 +7,13 @@ else ()
eigen
URL ${DEP_URL_eigen}
URL_HASH SHA1=${DEP_SHA1_eigen}
+ FIND_PACKAGE_ARGS NAMES Eigen3
)
- FetchContent_Populate(eigen)
- set(eigen_INCLUDE_DIRS "${eigen_SOURCE_DIR}")
+ FetchContent_MakeAvailable(eigen)
+ add_library(eigen ALIAS Eigen3::Eigen)
+ # Onnxruntime doesn't always use `eigen` as a target in
+ # `target_link_libraries`, sometimes it just uses
+ # `target_include_directories`:
+ get_target_property(eigen_INCLUDE_DIRS Eigen3::Eigen INTERFACE_INCLUDE_DIRECTORIES)
endif()