https://github.com/Kitware/CMake
Revision 1823ab4d76d8efe79bed85328a3f8c74c7d625bd authored by Brad King on 12 March 2013, 19:40:37 UTC, committed by Brad King on 12 March 2013, 20:33:19 UTC
The CMake language implicitly flattens lists so a ";" in a list element
must be escaped with a backslash.  List expansion removes backslashes
escaping semicolons to leave raw semicolons in the values.  Teach
ExternalData_Add_Test and ExternalData_Expand_Arguments to re-escape
semicolons found in list elements so the resulting argument lists work
as if constructed directly by the set() command.

For example:

  ExternalData_Add_Test(Data NAME test1 COMMAND ... "a\\;b")
  ExternalData_Expand_Arguments(Data args2 "c\\;d")
  add_test(NAME test2 COMMAND ... ${args2})

should be equivalent to

  set(args1 "a\\;b")
  add_test(NAME test1 COMMAND ... ${args1})
  set(args2 "c\\;d")
  add_test(NAME test2 COMMAND ... ${args2})

which is equivalent to

  add_test(NAME test1 COMMAND ... "a;b")
  add_test(NAME test2 COMMAND ... "c;d")

Note that it is not possible to make ExternalData_Add_Test act exactly
like add_test when quoted arguments contain semicolons because the CMake
language flattens lists when constructing function ARGN values.  This
re-escape approach at least allows test arguments to have semicolons.

While at it, teach ExternalData APIs to not transform "DATA{...;...}"
arguments because the contained semicolons are non-sensical.

Suggested-by: Jean-Christophe Fillion-Robin <jchris.fillionr@kitware.com>
1 parent 51fc4fb
History
Tip revision: 1823ab4d76d8efe79bed85328a3f8c74c7d625bd authored by Brad King on 12 March 2013, 19:40:37 UTC
ExternalData: Preserve escaped semicolons during argument expansion
Tip revision: 1823ab4
File Mode Size
Docs
Example
Modules
Source
Templates
Tests
Utilities
.gitattributes -rw-r--r-- 569 bytes
.hooks-config.bash -rw-r--r-- 866 bytes
CMakeCPack.cmake -rw-r--r-- 5.3 KB
CMakeCPackOptions.cmake.in -rw-r--r-- 3.4 KB
CMakeGraphVizOptions.cmake -rw-r--r-- 153 bytes
CMakeLists.txt -rw-r--r-- 24.8 KB
CMakeLogo.gif -rw-r--r-- 4.4 KB
CTestConfig.cmake -rw-r--r-- 1.0 KB
CTestCustom.cmake.in -rw-r--r-- 3.3 KB
CTestCustom.ctest.in -rw-r--r-- 145 bytes
ChangeLog.manual -rw-r--r-- 186.1 KB
ChangeLog.txt -rw-r--r-- 2.5 MB
CompileFlags.cmake -rw-r--r-- 2.5 KB
Copyright.txt -rw-r--r-- 2.6 KB
DartConfig.cmake -rw-r--r-- 809 bytes
DartLocal.conf.in -rw-r--r-- 4.0 KB
Readme.txt -rw-r--r-- 1.9 KB
bootstrap -rwxr-xr-x 52.2 KB
cmake_uninstall.cmake.in -rw-r--r-- 796 bytes
configure -rwxr-xr-x 99 bytes
doxygen.config -rw-r--r-- 27.4 KB

Readme.txt

back to top