diff --git a/Modules/CMakeLists.txt b/Modules/CMakeLists.txt index 3fb52defb..5bae440ee 100644 --- a/Modules/CMakeLists.txt +++ b/Modules/CMakeLists.txt @@ -1,2 +1,2 @@ # just install the modules -INSTALL_FILES(/share/CMake/Modules .*\.cmake$) +INSTALL_FILES(/share/CMake/Modules .*\\.cmake$) diff --git a/Modules/FindDart.cmake b/Modules/FindDart.cmake index 4aa8dafea..1fdf75960 100644 --- a/Modules/FindDart.cmake +++ b/Modules/FindDart.cmake @@ -7,5 +7,5 @@ FIND_PATH(DART_ROOT README.INSTALL ${PROJECT_SOURCE_DIR}/Dart /usr/share/Dart "C:/Program Files/Dart" - [HKEY_LOCAL_MACHINE\SOFTWARE\Dart\InstallPath] + [HKEY_LOCAL_MACHINE\\SOFTWARE\\Dart\\InstallPath] ) diff --git a/Modules/FindJNI.cmake b/Modules/FindJNI.cmake index c75d60e4a..c4a2a4cc9 100644 --- a/Modules/FindJNI.cmake +++ b/Modules/FindJNI.cmake @@ -10,14 +10,14 @@ FIND_LIBRARY(JAVA_AWT_LIBRARY jawt PATHS /usr/lib /usr/local/lib - "[HKEY_LOCAL_MACHINE\SOFTWARE\JavaSoft\Java Development Kit\1.3;JavaHome]/lib" + "[HKEY_LOCAL_MACHINE\\SOFTWARE\\JavaSoft\\Java Development Kit\\1.3;JavaHome]/lib" ) # add in the include path FIND_PATH(JAVA_INCLUDE_PATH jni.h /usr/include /usr/local/include - "[HKEY_LOCAL_MACHINE\SOFTWARE\JavaSoft\Java Development Kit\1.3;JavaHome]/include" + "[HKEY_LOCAL_MACHINE\\SOFTWARE\\JavaSoft\\Java Development Kit\\1.3;JavaHome]/include" ) FIND_PATH(JAVA_INCLUDE_PATH2 jni_md.h @@ -26,5 +26,3 @@ FIND_PATH(JAVA_INCLUDE_PATH2 jni_md.h ) FIND_PATH(JAVE_AWT_INCLUDE_PATH jawt.h ${JAVA_INCLUDE_PATH} ) - - diff --git a/Modules/FindPythonLibs.cmake b/Modules/FindPythonLibs.cmake index 22ea1425f..27c615a91 100644 --- a/Modules/FindPythonLibs.cmake +++ b/Modules/FindPythonLibs.cmake @@ -13,8 +13,8 @@ FIND_LIBRARY(PYTHON_DEBUG_LIBRARY PATHS /usr/lib /usr/local/lib - [HKEY_LOCAL_MACHINE\SOFTWARE\Python\PythonCore\2.1\InstallPath]/libs/Debug - [HKEY_LOCAL_MACHINE\SOFTWARE\Python\PythonCore\2.0\InstallPath]/libs/Debug + [HKEY_LOCAL_MACHINE\\SOFTWARE\\Python\\PythonCore\\2.1\\InstallPath]/libs/Debug + [HKEY_LOCAL_MACHINE\\SOFTWARE\\Python\\PythonCore\\2.0\\InstallPath]/libs/Debug ) FIND_LIBRARY(PYTHON_LIBRARY @@ -24,8 +24,8 @@ FIND_LIBRARY(PYTHON_LIBRARY /usr/lib/python2.1/config /usr/lib/python2.0/config /usr/local/lib - [HKEY_LOCAL_MACHINE\SOFTWARE\Python\PythonCore\2.1\InstallPath]/libs - [HKEY_LOCAL_MACHINE\SOFTWARE\Python\PythonCore\2.0\InstallPath]/libs + [HKEY_LOCAL_MACHINE\\SOFTWARE\\Python\\PythonCore\\2.1\\InstallPath]/libs + [HKEY_LOCAL_MACHINE\\SOFTWARE\\Python\\PythonCore\\2.0\\InstallPath]/libs ) FIND_PATH(PYTHON_INCLUDE_PATH Python.h @@ -33,7 +33,7 @@ FIND_PATH(PYTHON_INCLUDE_PATH Python.h /usr/include/python2.1 /usr/include/python2.0 /usr/local/include - [HKEY_LOCAL_MACHINE\SOFTWARE\Python\PythonCore\2.1\InstallPath]/include - [HKEY_LOCAL_MACHINE\SOFTWARE\Python\PythonCore\2.0\InstallPath]/include + [HKEY_LOCAL_MACHINE\\SOFTWARE\\Python\\PythonCore\\2.1\\InstallPath]/include + [HKEY_LOCAL_MACHINE\\SOFTWARE\\Python\\PythonCore\\2.0\\InstallPath]/include ) diff --git a/Modules/FindTCL.cmake b/Modules/FindTCL.cmake index ceff756f8..3d4d92c73 100644 --- a/Modules/FindTCL.cmake +++ b/Modules/FindTCL.cmake @@ -30,10 +30,10 @@ FIND_LIBRARY(TCL_LIBRARY /usr/lib /usr/local/lib "C:/Program Files/Tcl/lib" - [HKEY_LOCAL_MACHINE\SOFTWARE\Scriptics\Tcl\8.4;Root]/lib - [HKEY_LOCAL_MACHINE\SOFTWARE\Scriptics\Tcl\8.3;Root]/lib - [HKEY_LOCAL_MACHINE\SOFTWARE\Scriptics\Tcl\8.2;Root]/lib - [HKEY_LOCAL_MACHINE\SOFTWARE\Scriptics\Tcl\8.0;Root]/lib + [HKEY_LOCAL_MACHINE\\SOFTWARE\\Scriptics\\Tcl\\8.4;Root]/lib + [HKEY_LOCAL_MACHINE\\SOFTWARE\\Scriptics\\Tcl\\8.3;Root]/lib + [HKEY_LOCAL_MACHINE\\SOFTWARE\\Scriptics\\Tcl\\8.2;Root]/lib + [HKEY_LOCAL_MACHINE\\SOFTWARE\\Scriptics\\Tcl\\8.0;Root]/lib "${TCL_TCLSH_PATH}/../lib" "${TK_WISH_PATH}/../lib" ) @@ -44,10 +44,10 @@ FIND_LIBRARY(TK_LIBRARY /usr/lib /usr/local/lib "C:/Program Files/Tcl/lib" - [HKEY_LOCAL_MACHINE\SOFTWARE\Scriptics\Tcl\8.4;Root]/lib - [HKEY_LOCAL_MACHINE\SOFTWARE\Scriptics\Tcl\8.3;Root]/lib - [HKEY_LOCAL_MACHINE\SOFTWARE\Scriptics\Tcl\8.2;Root]/lib - [HKEY_LOCAL_MACHINE\SOFTWARE\Scriptics\Tcl\8.0;Root]/lib + [HKEY_LOCAL_MACHINE\\SOFTWARE\\Scriptics\\Tcl\\8.4;Root]/lib + [HKEY_LOCAL_MACHINE\\SOFTWARE\\Scriptics\\Tcl\\8.3;Root]/lib + [HKEY_LOCAL_MACHINE\\SOFTWARE\\Scriptics\\Tcl\\8.2;Root]/lib + [HKEY_LOCAL_MACHINE\\SOFTWARE\\Scriptics\\Tcl\\8.0;Root]/lib "${TCL_TCLSH_PATH}/../lib" "${TK_WISH_PATH}/../lib" ) @@ -56,10 +56,10 @@ FIND_PATH(TCL_INCLUDE_PATH tcl.h /usr/include /usr/local/include "C:/Program Files/Tcl/include" - [HKEY_LOCAL_MACHINE\SOFTWARE\Scriptics\Tcl\8.4;Root]/include - [HKEY_LOCAL_MACHINE\SOFTWARE\Scriptics\Tcl\8.3;Root]/include - [HKEY_LOCAL_MACHINE\SOFTWARE\Scriptics\Tcl\8.2;Root]/include - [HKEY_LOCAL_MACHINE\SOFTWARE\Scriptics\Tcl\8.0;Root]/include + [HKEY_LOCAL_MACHINE\\SOFTWARE\\Scriptics\\Tcl\\8.4;Root]/include + [HKEY_LOCAL_MACHINE\\SOFTWARE\\Scriptics\\Tcl\\8.3;Root]/include + [HKEY_LOCAL_MACHINE\\SOFTWARE\\Scriptics\\Tcl\\8.2;Root]/include + [HKEY_LOCAL_MACHINE\\SOFTWARE\\Scriptics\\Tcl\\8.0;Root]/include "${TCL_TCLSH_PATH}/../include" "${TK_WISH_PATH}/../include" ) @@ -68,10 +68,10 @@ FIND_PATH(TK_INCLUDE_PATH tk.h /usr/include /usr/local/include "C:/Program Files/Tcl/include" - [HKEY_LOCAL_MACHINE\SOFTWARE\Scriptics\Tcl\8.4;Root]/include - [HKEY_LOCAL_MACHINE\SOFTWARE\Scriptics\Tcl\8.3;Root]/include - [HKEY_LOCAL_MACHINE\SOFTWARE\Scriptics\Tcl\8.2;Root]/include - [HKEY_LOCAL_MACHINE\SOFTWARE\Scriptics\Tcl\8.0;Root]/include + [HKEY_LOCAL_MACHINE\\SOFTWARE\\Scriptics\\Tcl\\8.4;Root]/include + [HKEY_LOCAL_MACHINE\\SOFTWARE\\Scriptics\\Tcl\\8.3;Root]/include + [HKEY_LOCAL_MACHINE\\SOFTWARE\\Scriptics\\Tcl\\8.2;Root]/include + [HKEY_LOCAL_MACHINE\\SOFTWARE\\Scriptics\\Tcl\\8.0;Root]/include "${TCL_TCLSH_PATH}/../include" "${TK_WISH_PATH}/../include" ) @@ -80,10 +80,10 @@ FIND_PATH(TK_INTERNAL_PATH tkWinInt.h /usr/include /usr/local/include "C:/Program Files/Tcl/include" - [HKEY_LOCAL_MACHINE\SOFTWARE\Scriptics\Tcl\8.4;Root]/include - [HKEY_LOCAL_MACHINE\SOFTWARE\Scriptics\Tcl\8.3;Root]/include - [HKEY_LOCAL_MACHINE\SOFTWARE\Scriptics\Tcl\8.2;Root]/include - [HKEY_LOCAL_MACHINE\SOFTWARE\Scriptics\Tcl\8.0;Root]/include + [HKEY_LOCAL_MACHINE\\SOFTWARE\\Scriptics\\Tcl\\8.4;Root]/include + [HKEY_LOCAL_MACHINE\\SOFTWARE\\Scriptics\\Tcl\\8.3;Root]/include + [HKEY_LOCAL_MACHINE\\SOFTWARE\\Scriptics\\Tcl\\8.2;Root]/include + [HKEY_LOCAL_MACHINE\\SOFTWARE\\Scriptics\\Tcl\\8.0;Root]/include "${TCL_TCLSH_PATH}/../include" "${TK_WISH_PATH}/../include" ) diff --git a/Source/cmSystemTools.cxx b/Source/cmSystemTools.cxx index ee986b6a0..5428081d5 100644 --- a/Source/cmSystemTools.cxx +++ b/Source/cmSystemTools.cxx @@ -524,9 +524,9 @@ void cmSystemTools::GetArguments(std::string& line, std::vector& arguments) { // Match a normal argument (not quoted, no spaces). - cmRegularExpression normalArgument("[\t ]*([^\" \t]+)[\t ]*"); + cmRegularExpression normalArgument("[ \t]*(([^ \t\\]|[\\].)+)[ \t]*"); // Match a quoted argument (surrounded by double quotes, spaces allowed). - cmRegularExpression quotedArgument("[\t ]*(\"[^\"]*\")[\t ]*"); + cmRegularExpression quotedArgument("[ \t]*(\"([^\"\\]|[\\].)*\")[ \t]*"); bool done = false; while(!done) @@ -539,6 +539,7 @@ void cmSystemTools::GetArguments(std::string& line, if(foundQuoted && foundNormal) { // Both matches were found. Take the earlier one. + // Favor double-quoted version if there is a tie. if(normalArgument.start(1) < quotedArgument.start(1)) { arg = normalArgument.match(1); @@ -570,12 +571,51 @@ void cmSystemTools::GetArguments(std::string& line, } if(!done) { - arguments.push_back(arg); + arguments.push_back(cmSystemTools::RemoveEscapes(arg.c_str())); line = line.substr(endpos, line.length() - endpos); } } } + +std::string cmSystemTools::RemoveEscapes(const char* s) +{ + std::string result = ""; + for(const char* ch = s; *ch; ++ch) + { + if(*ch == '\\') + { + ++ch; + switch (*ch) + { + case '\\': result.insert(result.end(), '\\'); break; + case '"': result.insert(result.end(), '"'); break; + case ' ': result.insert(result.end(), ' '); break; + case 't': result.insert(result.end(), '\t'); break; + case 'n': result.insert(result.end(), '\n'); break; + case 'r': result.insert(result.end(), '\r'); break; + case '0': result.insert(result.end(), '\0'); break; + case '\0': + { + cmSystemTools::Error("Trailing backslash in argument:\n", s); + return result; + } + default: + { + std::string chStr(1, *ch); + cmSystemTools::Error("Invalid escape sequence \\", chStr.c_str(), + "\nin argument ", s); + } + } + } + else + { + result.insert(result.end(), *ch); + } + } + return result; +} + void cmSystemTools::Error(const char* m1, const char* m2, const char* m3, const char* m4) { diff --git a/Source/cmSystemTools.h b/Source/cmSystemTools.h index 87f63c7c0..d5566ba02 100644 --- a/Source/cmSystemTools.h +++ b/Source/cmSystemTools.h @@ -132,6 +132,13 @@ public: */ static void GetArguments(std::string& line, std::vector& arguments); + + /** + * Given a string, replace any escape sequences with the corresponding + * characters. + */ + static std::string RemoveEscapes(const char*); + /** * Add the paths from the environment variable PATH to the diff --git a/Templates/configure b/Templates/configure index 8abcf525b..1dc4fa0ac 100755 --- a/Templates/configure +++ b/Templates/configure @@ -2449,7 +2449,7 @@ fi CMAKE_SHLIB_LD_LIBS="" CMAKE_SHLIB_SUFFIX=".so" CMAKE_DL_LIBS="" - CMAKE_SHLIB_BUILD_FLAGS='-shared -Wl,-expect_unresolved,\*' + CMAKE_SHLIB_BUILD_FLAGS='-shared -Wl,-expect_unresolved,\\*' CMAKE_SHLIB_LINK_FLAGS='' CMAKE_SHLIB_RUNTIME_FLAG="-Wl,-rpath," CMAKE_SHLIB_RUNTIME_SEP=":" diff --git a/Templates/configure.in b/Templates/configure.in index c648c4e5e..ab6bd3ef2 100644 --- a/Templates/configure.in +++ b/Templates/configure.in @@ -263,7 +263,7 @@ case $system in CMAKE_SHLIB_LD_LIBS="" CMAKE_SHLIB_SUFFIX=".so" CMAKE_DL_LIBS="" - CMAKE_SHLIB_BUILD_FLAGS='-shared -Wl,-expect_unresolved,\*' + CMAKE_SHLIB_BUILD_FLAGS='-shared -Wl,-expect_unresolved,\\*' CMAKE_SHLIB_LINK_FLAGS='' CMAKE_SHLIB_RUNTIME_FLAG="-Wl,-rpath," CMAKE_SHLIB_RUNTIME_SEP=":"