diff options
Diffstat (limited to 'Source/cmExportFileGenerator.cxx')
-rw-r--r-- | Source/cmExportFileGenerator.cxx | 24 |
1 files changed, 21 insertions, 3 deletions
diff --git a/Source/cmExportFileGenerator.cxx b/Source/cmExportFileGenerator.cxx index a51fb2a..094ad4f 100644 --- a/Source/cmExportFileGenerator.cxx +++ b/Source/cmExportFileGenerator.cxx @@ -23,12 +23,28 @@ #include "cmVersion.h" #include "cmComputeLinkInformation.h" #include "cmAlgorithms.h" +#include "cmOutputConverter.h" #include <cmsys/auto_ptr.hxx> #include <cmsys/FStream.hxx> #include <assert.h> //---------------------------------------------------------------------------- +static std::string cmExportFileGeneratorEscape(std::string const& str) +{ + // Escape a property value for writing into a .cmake file. + std::string result = cmOutputConverter::EscapeForCMake(str); + // Un-escape variable references generated by our own export code. + cmSystemTools::ReplaceString(result, + "\\${_IMPORT_PREFIX}", + "${_IMPORT_PREFIX}"); + cmSystemTools::ReplaceString(result, + "\\${CMAKE_IMPORT_LIBRARY_SUFFIX}", + "${CMAKE_IMPORT_LIBRARY_SUFFIX}"); + return result; +} + +//---------------------------------------------------------------------------- cmExportFileGenerator::cmExportFileGenerator() { this->AppendMode = false; @@ -608,7 +624,8 @@ void cmExportFileGenerator::GenerateInterfaceProperties(cmTarget const* target, for(ImportPropertyMap::const_iterator pi = properties.begin(); pi != properties.end(); ++pi) { - os << " " << pi->first << " \"" << pi->second << "\"\n"; + os << " " << pi->first << " " + << cmExportFileGeneratorEscape(pi->second) << "\n"; } os << ")\n\n"; } @@ -1112,7 +1129,8 @@ cmExportFileGenerator for(ImportPropertyMap::const_iterator pi = properties.begin(); pi != properties.end(); ++pi) { - os << " " << pi->first << " \"" << pi->second << "\"\n"; + os << " " << pi->first << " " + << cmExportFileGeneratorEscape(pi->second) << "\n"; } os << " )\n" << "\n"; @@ -1223,7 +1241,7 @@ cmExportFileGenerator ImportPropertyMap::const_iterator pi = properties.find(*li); if (pi != properties.end()) { - os << "\"" << pi->second << "\" "; + os << cmExportFileGeneratorEscape(pi->second) << " "; } } |