diff options
author | Brad King <brad.king@kitware.com> | 2006-09-28 15:30:49 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2006-09-28 15:30:49 (GMT) |
commit | d01b6f12819c4d8aec189ae3eebfd1779565bbf2 (patch) | |
tree | 90a04b304477a20c1adbc46b5ee2d892e4aae64b /Tests/CustomCommand | |
parent | 16f8da8b1443b7ebb315f40aa1ae199d87f211de (diff) | |
download | CMake-d01b6f12819c4d8aec189ae3eebfd1779565bbf2.zip CMake-d01b6f12819c4d8aec189ae3eebfd1779565bbf2.tar.gz CMake-d01b6f12819c4d8aec189ae3eebfd1779565bbf2.tar.bz2 |
ENH: Added VERBATIM option to ADD_CUSTOM_COMMAND and ADD_CUSTOM_TARGET commands. This option enables full escaping of custom command arguments on all platforms. See bug#3786.
Diffstat (limited to 'Tests/CustomCommand')
-rw-r--r-- | Tests/CustomCommand/CMakeLists.txt | 34 | ||||
-rw-r--r-- | Tests/CustomCommand/check_command_line.c.in | 3 |
2 files changed, 35 insertions, 2 deletions
diff --git a/Tests/CustomCommand/CMakeLists.txt b/Tests/CustomCommand/CMakeLists.txt index 3af8540..f50de52 100644 --- a/Tests/CustomCommand/CMakeLists.txt +++ b/Tests/CustomCommand/CMakeLists.txt @@ -176,6 +176,17 @@ SET(CHECK_ARGS double\"quote "\\;semi-colons\\;" "semi\\;colon" + `back-ticks` + back`tick + "(parens)" + "(lparen" + "rparen)" + $dollar-signs$ + dollar$sign + &ersands& + amper&sand + \@two-ats\@ + one@at "c:/posix/path/with space" "c:\\windows\\path\\with space" "'single quotes with space'" @@ -184,6 +195,17 @@ SET(CHECK_ARGS "double\"quote with space" "\\;semi-colons with space\\;" "semi\\;colon with space" + "`back-ticks` with space" + "back`tick with space" + "(parens) with space" + "(lparen with space" + "rparen) with space" + "$dollar-signs$ with space" + "dollar$sign with space" + "&ersands& with space" + "amper&sand with space" + "\@two-ats\@ with space" + "one@at with space" ) FOREACH(arg ${CHECK_ARGS}) SET(ARG "${arg}") @@ -199,8 +221,18 @@ CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/check_command_line.c.in @ONLY IMMEDIATE) ADD_EXECUTABLE(check_command_line ${CMAKE_CURRENT_BINARY_DIR}/check_command_line.c) -ADD_CUSTOM_TARGET(do_check_command_line #ALL +ADD_CUSTOM_COMMAND( + OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/command_line_check + COMMAND ${EXECUTABLE_OUTPUT_PATH}/${CMAKE_CFG_INTDIR}/check_command_line + ${CHECK_ARGS} + VERBATIM + COMMENT "Checking custom command line escapes" + ) +ADD_CUSTOM_TARGET(do_check_command_line ALL + DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/command_line_check + COMMAND ${CMAKE_COMMAND} -E echo "Checking custom target command escapes" COMMAND ${EXECUTABLE_OUTPUT_PATH}/${CMAKE_CFG_INTDIR}/check_command_line ${CHECK_ARGS} + VERBATIM ) ADD_DEPENDENCIES(do_check_command_line check_command_line) diff --git a/Tests/CustomCommand/check_command_line.c.in b/Tests/CustomCommand/check_command_line.c.in index a4dbe22..71d5278 100644 --- a/Tests/CustomCommand/check_command_line.c.in +++ b/Tests/CustomCommand/check_command_line.c.in @@ -20,7 +20,7 @@ int main(int argc, const char* argv[]) } else { - printf("[%s]\n", *a); + /*printf("[%s]\n", *a);*/ } } if(*a || *e) @@ -28,5 +28,6 @@ int main(int argc, const char* argv[]) fprintf(stderr, "Number of arguments does not match expected.\n"); return 1; } + printf("Command line escapes work!\n"); return 0; } |