mirror of
https://github.com/Kitware/CMake.git
synced 2026-01-05 21:31:08 -06:00
exports: accept a missing target if it is exported exactly once
If a target is exported, and a library it depends on is not part of the same export set, before this patch cmake errored out. With this patch, it now checks whether the missing target is exported somewhere else exactly once, and accepts in this case (because then it can determine the namespace for the missing target and use this). Alex
This commit is contained in:
@@ -135,7 +135,8 @@ cmExportBuildFileGenerator
|
||||
void
|
||||
cmExportBuildFileGenerator
|
||||
::ComplainAboutMissingTarget(cmTarget* depender,
|
||||
cmTarget* dependee)
|
||||
cmTarget* dependee,
|
||||
int occurrences)
|
||||
{
|
||||
if(!this->ExportCommand || !this->ExportCommand->ErrorMessage.empty())
|
||||
{
|
||||
@@ -143,10 +144,20 @@ cmExportBuildFileGenerator
|
||||
}
|
||||
|
||||
cmOStringStream e;
|
||||
e << "called with target \"" << depender->GetName()
|
||||
<< "\" which requires target \"" << dependee->GetName()
|
||||
<< "\" that is not in the export list.\n"
|
||||
<< "If the required target is not easy to reference in this call, "
|
||||
<< "consider using the APPEND option with multiple separate calls.";
|
||||
if (occurrences == 0)
|
||||
{
|
||||
e << "called with target \"" << depender->GetName()
|
||||
<< "\" which requires target \"" << dependee->GetName()
|
||||
<< "\" that is not in the export list.\n"
|
||||
<< "If the required target is not easy to reference in this call, "
|
||||
<< "consider using the APPEND option with multiple separate calls.";
|
||||
}
|
||||
else
|
||||
{
|
||||
e << "called with target \"" << depender->GetName()
|
||||
<< "\" which requires target \"" << dependee->GetName()
|
||||
<< "\" that is exported " << occurrences << " times in other "
|
||||
<< "export ""lists.\n";
|
||||
}
|
||||
this->ExportCommand->ErrorMessage = e.str();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user