diff options
author | Brad King <brad.king@kitware.com> | 2006-09-21 20:11:25 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2006-09-21 20:11:25 (GMT) |
commit | ca22f0f14b1c4f93f28007cb2decd221f269ab76 (patch) | |
tree | 22ad4577319bf0b0ad6d355372245bd3c2dc569b /Tests/CustomCommand/CMakeLists.txt | |
parent | b9fc06735da95cd0f96c96012dd98c7ab5be56e6 (diff) | |
download | CMake-ca22f0f14b1c4f93f28007cb2decd221f269ab76.zip CMake-ca22f0f14b1c4f93f28007cb2decd221f269ab76.tar.gz CMake-ca22f0f14b1c4f93f28007cb2decd221f269ab76.tar.bz2 |
ENH: Adding test for non-trivial custom command line arguments. This is for bug#3786.
Diffstat (limited to 'Tests/CustomCommand/CMakeLists.txt')
-rw-r--r-- | Tests/CustomCommand/CMakeLists.txt | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/Tests/CustomCommand/CMakeLists.txt b/Tests/CustomCommand/CMakeLists.txt index 2fb4725..546a6cc 100644 --- a/Tests/CustomCommand/CMakeLists.txt +++ b/Tests/CustomCommand/CMakeLists.txt @@ -164,3 +164,42 @@ TARGET_LINK_LIBRARIES(CustomCommand GeneratedHeader) # the CustomCommand executable really needs doc1.h ADD_DEPENDENCIES(CustomCommand TDocument) +############################################################################## +# Test non-trivial command line arguments in custom commands. +SET(EXPECTED_ARGUMENTS) +SET(CHECK_ARGS + c:/posix/path + c:\\windows\\path + 'single-quotes' + single'quote + \"double-quotes\" + double\"quote + "\\;semi-colons\\;" + "semi\\;colon" + "c:/posix/path/with space" + "c:\\windows\\path\\with space" + "'single quotes with space'" + "single'quote with space" + "\"double-quotes with space\"" + "double\"quote with space" + "\\;semi-colons with space\\;" + "semi\\;colon with space" + ) +FOREACH(arg ${CHECK_ARGS}) + SET(ARG "${arg}") + STRING(REGEX REPLACE "\\\\" "\\\\\\\\" ARG "${ARG}") + STRING(REGEX REPLACE "\"" "\\\\\"" ARG "${ARG}") + SET(EXPECTED_ARGUMENTS + "${EXPECTED_ARGUMENTS} \"${ARG}\", +") +ENDFOREACH(arg) +CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/check_command_line.c.in + ${CMAKE_CURRENT_BINARY_DIR}/check_command_line.c + @ONLY IMMEDIATE) +ADD_EXECUTABLE(check_command_line + ${CMAKE_CURRENT_BINARY_DIR}/check_command_line.c) +ADD_CUSTOM_TARGET(do_check_command_line ALL + COMMAND ${EXECUTABLE_OUTPUT_PATH}/${CMAKE_CFG_INTDIR}/check_command_line + ${CHECK_ARGS} + ) +ADD_DEPENDENCIES(do_check_command_line check_command_line) |