145{
146 static std::unordered_map<std::string, std::string> cache;
147
148 auto it = cache.find(library_name);
149 if (it != cache.end()) {
150 return it->second;
151 }
152
153 std::string& result = cache[library_name];
154 if (library_name == "Eigen" || library_name == "eigen") {
155 if (!Config::EIGEN_HINT.empty() && fs::exists(Config::EIGEN_HINT)) {
156 result = Config::EIGEN_HINT;
157 } else {
158 for (const auto& path : eigen_includes) {
159 if (std::filesystem::exists(path)) {
160 result = path;
161 break;
162 }
163 }
164 }
165 } else if (library_name == "freetype2" || library_name == "freetype") {
166 if (!Config::FREETYPE_HINT.empty() && fs::exists(Config::FREETYPE_HINT)) {
167 result = Config::FREETYPE_HINT;
168 } else {
169 for (const auto& path : freetype_includes) {
170 if (std::filesystem::exists(path)) {
171 result = path;
172 break;
173 }
174 }
175 }
176 }
177
178 return result;
179}