diff options
author | Stephen Kelly <steveire@gmail.com> | 2012-11-30 08:26:09 (GMT) |
---|---|---|
committer | Stephen Kelly <steveire@gmail.com> | 2012-11-30 08:51:17 (GMT) |
commit | bf2ddceb4e55b2b9e3fb749fbee6126340f73f07 (patch) | |
tree | 8bf995edfd69e1a11dfbc65aad9415559559a1fe /Source/cmExportBuildFileGenerator.cxx | |
parent | d5ac791366595be307896e9894c66815c1e1eb2f (diff) | |
download | CMake-bf2ddceb4e55b2b9e3fb749fbee6126340f73f07.zip CMake-bf2ddceb4e55b2b9e3fb749fbee6126340f73f07.tar.gz CMake-bf2ddceb4e55b2b9e3fb749fbee6126340f73f07.tar.bz2 |
Generate an early-return guard in target Export files.
Previously it was necessary for writers of Config files
which incude exported target files to write the guard themselves, but
this was not immediately obvious or documented. Options for them
would be to use a variable, or an INHERITED directory property in an
effort to avoid accidental name clashes in all contexts in
which find_package can be used.
Getting this right requires boiler plate code, so generate a simpler
check automatically instead.
Diffstat (limited to 'Source/cmExportBuildFileGenerator.cxx')
-rw-r--r-- | Source/cmExportBuildFileGenerator.cxx | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/Source/cmExportBuildFileGenerator.cxx b/Source/cmExportBuildFileGenerator.cxx index fb3f39f..cd6a7ab 100644 --- a/Source/cmExportBuildFileGenerator.cxx +++ b/Source/cmExportBuildFileGenerator.cxx @@ -22,6 +22,20 @@ cmExportBuildFileGenerator::cmExportBuildFileGenerator() //---------------------------------------------------------------------------- bool cmExportBuildFileGenerator::GenerateMainFile(std::ostream& os) { + { + std::string expectedTargets; + std::string sep; + for(std::vector<cmTarget*>::const_iterator + tei = this->Exports->begin(); + tei != this->Exports->end(); ++tei) + { + expectedTargets += sep + this->Namespace + (*tei)->GetName(); + sep = " "; + } + + this->GenerateExpectedTargetsCode(os, expectedTargets); + } + // Create all the imported targets. for(std::vector<cmTarget*>::const_iterator tei = this->Exports->begin(); |