summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Source/cmExportFileGenerator.cxx9
-rw-r--r--Source/cmFindPackageCommand.cxx2
2 files changed, 10 insertions, 1 deletions
diff --git a/Source/cmExportFileGenerator.cxx b/Source/cmExportFileGenerator.cxx
index 5d95668..8dffae4 100644
--- a/Source/cmExportFileGenerator.cxx
+++ b/Source/cmExportFileGenerator.cxx
@@ -389,8 +389,15 @@ void cmExportFileGenerator::GenerateMissingTargetsCheckCode(std::ostream& os,
for(unsigned int i=0; i<missingTargets.size(); ++i)
{
os << "IF(NOT TARGET \"" << missingTargets[i] << "\" )\n"
- << " MESSAGE(FATAL_ERROR \"Required imported target \\\""
+ << " IF(CMAKE_FIND_PACKAGE_NAME)\n"
+ << " SET( ${CMAKE_FIND_PACKAGE_NAME}_FOUND FALSE)\n"
+ << " SET( ${CMAKE_FIND_PACKAGE_NAME}_NOT_FOUND_MESSAGE "
+ << "\"Required imported target \\\"" << missingTargets[i]
+ << "\\\" not found ! \")\n"
+ << " ELSE()\n"
+ << " MESSAGE(FATAL_ERROR \"Required imported target \\\""
<< missingTargets[i] << "\\\" not found ! \")\n"
+ << " ENDIF()\n"
<< "ENDIF()\n";
}
os << "\n";
diff --git a/Source/cmFindPackageCommand.cxx b/Source/cmFindPackageCommand.cxx
index c20941a..470ceca 100644
--- a/Source/cmFindPackageCommand.cxx
+++ b/Source/cmFindPackageCommand.cxx
@@ -840,6 +840,8 @@ bool cmFindPackageCommand
//----------------------------------------------------------------------------
void cmFindPackageCommand::SetModuleVariables(const std::string& components)
{
+ this->AddFindDefinition("CMAKE_FIND_PACKAGE_NAME", this->Name.c_str());
+
// Store the list of components.
std::string components_var = this->Name + "_FIND_COMPONENTS";
this->AddFindDefinition(components_var.c_str(), components.c_str());