mirror of
https://github.com/Kitware/CMake.git
synced 2026-05-13 01:29:02 -05:00
install(EXPORT): Use UNWIND_INCLUDE in exported find_dependency()
This commit is contained in:
@@ -451,16 +451,27 @@ void cmExportCMakeConfigGenerator::GenerateFindDependencyCalls(
|
||||
return lhs.second.FindPackageIndex < rhs.second.FindPackageIndex;
|
||||
});
|
||||
|
||||
// Unwinding is only valid in a find_package() context
|
||||
os << "if(DEFINED CMAKE_FIND_PACKAGE_NAME)\n"
|
||||
<< " set(_cmake_unwind_arg UNWIND_INCLUDE)\n"
|
||||
<< "endif()\n\n";
|
||||
|
||||
for (auto const& it : packageDependenciesSorted) {
|
||||
if (it.second.Enabled == cmExportSet::PackageDependencyExportEnabled::On) {
|
||||
os << "find_dependency(" << it.first;
|
||||
os << "__find_dependency_no_return(" << it.first;
|
||||
for (auto const& arg : it.second.ExtraArguments) {
|
||||
os << ' ' << cmOutputConverter::EscapeForCMake(arg);
|
||||
}
|
||||
os << ")\n";
|
||||
os << " ${_cmake_unwind_arg})\n";
|
||||
os << "if(NOT " << it.first << "_FOUND)\n"
|
||||
<< " unset(_cmake_unwind_arg)\n"
|
||||
<< " cmake_policy(POP)\n"
|
||||
<< " return()\n"
|
||||
<< "endif()\n\n";
|
||||
}
|
||||
}
|
||||
os << "\n\n";
|
||||
|
||||
os << "unset(_cmake_unwind_arg)\n\n\n";
|
||||
}
|
||||
|
||||
void cmExportCMakeConfigGenerator::GenerateMissingTargetsCheckCode(
|
||||
|
||||
Reference in New Issue
Block a user