132{
133 static std::unordered_map<std::string, std::string> cache;
134
135 auto it = cache.find(library_name);
136 if (it != cache.end()) {
137 return it->second;
138 }
139
140 std::string& result = cache[library_name];
141 if (library_name == "Eigen" || library_name == "eigen") {
142 if (!Config::EIGEN_HINT.empty() && fs::exists(Config::EIGEN_HINT)) {
143 result = Config::EIGEN_HINT;
144 } else {
145 for (const auto& path : eigen_includes) {
146 if (std::filesystem::exists(path)) {
147 result = path;
148 break;
149 }
150 }
151 }
152 }
153
154 return result;
155}