[Cmake-commits] CMake branch, next, updated. v3.3.0-rc2-638-gd50bb53
Brad King
brad.king at kitware.com
Tue Jun 23 11:41:15 EDT 2015
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "CMake".
The branch, next has been updated
via d50bb530ba4db134a0674a17908bcda9ab5d1537 (commit)
via c47cc24981b873ce0a22374512be67aae9c1a4d1 (commit)
from 67033efd33fd5dd0dd2cd6e6dd7623b9f56dc166 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=d50bb530ba4db134a0674a17908bcda9ab5d1537
commit d50bb530ba4db134a0674a17908bcda9ab5d1537
Merge: 67033ef c47cc24
Author: Brad King <brad.king at kitware.com>
AuthorDate: Tue Jun 23 11:41:14 2015 -0400
Commit: CMake Topic Stage <kwrobot at kitware.com>
CommitDate: Tue Jun 23 11:41:14 2015 -0400
Merge topic 'export-escaping' into next
c47cc249 Export: Escape exported property values when writing CMake language files
http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=c47cc24981b873ce0a22374512be67aae9c1a4d1
commit c47cc24981b873ce0a22374512be67aae9c1a4d1
Author: Brad King <brad.king at kitware.com>
AuthorDate: Tue Jun 23 10:54:23 2015 -0400
Commit: Brad King <brad.king at kitware.com>
CommitDate: Tue Jun 23 11:19:05 2015 -0400
Export: Escape exported property values when writing CMake language files
When writing export files, correctly encode property values that contain
characters special to the CMake language parser. We must ensure that
they parse correctly when loaded on the consuming side.
Reported-by: Dan Liew <dan at su-root.co.uk>
diff --git a/Source/cmExportFileGenerator.cxx b/Source/cmExportFileGenerator.cxx
index a51fb2a..35ea646 100644
--- a/Source/cmExportFileGenerator.cxx
+++ b/Source/cmExportFileGenerator.cxx
@@ -23,12 +23,25 @@
#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 our import prefix variable reference as a special case.
+ cmSystemTools::ReplaceString(result,
+ "\\${_IMPORT_PREFIX}",
+ "${_IMPORT_PREFIX}");
+ return result;
+}
+
+//----------------------------------------------------------------------------
cmExportFileGenerator::cmExportFileGenerator()
{
this->AppendMode = false;
@@ -608,7 +621,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 +1126,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 +1238,7 @@ cmExportFileGenerator
ImportPropertyMap::const_iterator pi = properties.find(*li);
if (pi != properties.end())
{
- os << "\"" << pi->second << "\" ";
+ os << cmExportFileGeneratorEscape(pi->second) << " ";
}
}
diff --git a/Tests/ExportImport/Export/Interface/CMakeLists.txt b/Tests/ExportImport/Export/Interface/CMakeLists.txt
index 00a5375..fd55c42 100644
--- a/Tests/ExportImport/Export/Interface/CMakeLists.txt
+++ b/Tests/ExportImport/Export/Interface/CMakeLists.txt
@@ -39,7 +39,11 @@ install(FILES
DESTINATION src
)
+add_library(cmakeonly INTERFACE)
+set_property(TARGET cmakeonly PROPERTY INTERFACE_COMPILE_DEFINITIONS [[DEF="\"\$\B"]])
+
install(TARGETS headeronly sharediface use_auto_type use_c_restrict source_target
+ cmakeonly
EXPORT expInterface
)
install(TARGETS sharedlib
diff --git a/Tests/ExportImport/Import/Interface/CMakeLists.txt b/Tests/ExportImport/Import/Interface/CMakeLists.txt
index 51d518e..c850508 100644
--- a/Tests/ExportImport/Import/Interface/CMakeLists.txt
+++ b/Tests/ExportImport/Import/Interface/CMakeLists.txt
@@ -99,3 +99,14 @@ add_executable(interfacetest_exp interfacetest.cpp)
target_link_libraries(interfacetest_exp exp::sharediface)
do_try_compile(exp)
+
+foreach(ns exp bld)
+ get_property(defs TARGET ${ns}::cmakeonly PROPERTY INTERFACE_COMPILE_DEFINITIONS)
+ if(NOT defs STREQUAL [[DEF="\"\$\B"]])
+ message(SEND_ERROR
+ "${ns}::cmakeonly property INTERFACE_COMPILE_DEFINITIONS is:\n"
+ " ${defs}\n"
+ "not\n"
+ " " [[DEF="\"\$\B"]] "\n")
+ endif()
+endforeach()
-----------------------------------------------------------------------
Summary of changes:
Source/cmExportFileGenerator.cxx | 21 +++++++++++++++++---
Tests/ExportImport/Export/Interface/CMakeLists.txt | 4 ++++
Tests/ExportImport/Import/Interface/CMakeLists.txt | 11 ++++++++++
3 files changed, 33 insertions(+), 3 deletions(-)
hooks/post-receive
--
CMake
More information about the Cmake-commits
mailing list