summaryrefslogtreecommitdiffstats
path: root/Tests
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2015-06-23 14:54:23 (GMT)
committerBrad King <brad.king@kitware.com>2015-06-24 13:19:39 (GMT)
commit60eb396f104ff6c662029b16f8859288776afbe8 (patch)
tree52400216d9843bd96296bf2af83df1d12340aed4 /Tests
parentd0c0efb5ccc57cc01e25fc5e21a16e0c86d1ea70 (diff)
downloadCMake-60eb396f104ff6c662029b16f8859288776afbe8.zip
CMake-60eb396f104ff6c662029b16f8859288776afbe8.tar.gz
CMake-60eb396f104ff6c662029b16f8859288776afbe8.tar.bz2
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@su-root.co.uk>
Diffstat (limited to 'Tests')
-rw-r--r--Tests/ExportImport/Export/Interface/CMakeLists.txt4
-rw-r--r--Tests/ExportImport/Import/Interface/CMakeLists.txt11
2 files changed, 15 insertions, 0 deletions
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()