Enable calling commands with : in argv[1] (#9963)
The solution seems hackish, but it works: for NMake only, prepend a no-op command before each real command that begins with ". This is really a work-around for an NMake problem. When a command begins with ", nmake truncates the first argument to the command after the first : in that arg. It has a parsing problem. Workaround..., hackish..., but it should solve the issue for #9963 and its related friends. Also, modify the CustomCommand test to replicate the problem reported in issue #9963. Before the NMake specific code change, the test failed. Now, it passes. Ahhhhhh.
This commit is contained in:
parent
de346204b8
commit
269a4b876a
|
@ -1062,10 +1062,17 @@ cmLocalUnixMakefileGenerator3
|
|||
}
|
||||
}
|
||||
}
|
||||
if (useCall && launcher.empty())
|
||||
if (launcher.empty())
|
||||
{
|
||||
if (useCall)
|
||||
{
|
||||
cmd = "call " + cmd;
|
||||
}
|
||||
else if (this->NMake && cmd[0]=='"')
|
||||
{
|
||||
cmd = "echo >nul && " + cmd;
|
||||
}
|
||||
}
|
||||
commands1.push_back(cmd);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -376,7 +376,7 @@ ${CMake_BINARY_DIR}/bin/cmake -DVERSION=master -P ${CMake_SOURCE_DIR}/Utilities/
|
|||
--build-generator ${CMAKE_TEST_GENERATOR}
|
||||
--build-project CustomCommand
|
||||
--build-makeprogram ${CMAKE_TEST_MAKEPROGRAM}
|
||||
--build-exe-dir "${CMake_BINARY_DIR}/Tests/CustomCommand/bin"
|
||||
--build-exe-dir "${CMake_BINARY_DIR}/Tests/CustomCommand/bin dir"
|
||||
--test-command CustomCommand
|
||||
)
|
||||
LIST(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/CustomCommand")
|
||||
|
|
|
@ -10,11 +10,11 @@ ADD_SUBDIRECTORY(GeneratedHeader)
|
|||
# Lib and exe path
|
||||
#
|
||||
SET (LIBRARY_OUTPUT_PATH
|
||||
${PROJECT_BINARY_DIR}/bin/ CACHE INTERNAL
|
||||
"${PROJECT_BINARY_DIR}/bin dir" CACHE INTERNAL
|
||||
"Single output directory for building all libraries.")
|
||||
|
||||
SET (EXECUTABLE_OUTPUT_PATH
|
||||
${PROJECT_BINARY_DIR}/bin/ CACHE INTERNAL
|
||||
"${PROJECT_BINARY_DIR}/bin dir" CACHE INTERNAL
|
||||
"Single output directory for building all executables.")
|
||||
|
||||
################################################################
|
||||
|
@ -221,6 +221,7 @@ ADD_CUSTOM_COMMAND(OUTPUT gen_redirect.c
|
|||
# Test non-trivial command line arguments in custom commands.
|
||||
SET(EXPECTED_ARGUMENTS)
|
||||
SET(CHECK_ARGS
|
||||
-DPATH=c:/posix/path
|
||||
c:/posix/path
|
||||
c:\\windows\\path
|
||||
'single-quotes'
|
||||
|
@ -273,6 +274,8 @@ SET(CHECK_ARGS
|
|||
|nopipe
|
||||
"#two-pounds#"
|
||||
"one#pound"
|
||||
":two-colons:"
|
||||
"one:colon"
|
||||
"#nocomment"
|
||||
"c:/posix/path/with space"
|
||||
"c:\\windows\\path\\with space"
|
||||
|
@ -359,13 +362,15 @@ 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)
|
||||
SET_PROPERTY(TARGET check_command_line
|
||||
PROPERTY OUTPUT_NAME "check command line")
|
||||
# SET_TARGET_PROPERTIES(check_command_line PROPERTIES
|
||||
# COMPILE_FLAGS -DCHECK_COMMAND_LINE_VERBOSE)
|
||||
ADD_CUSTOM_COMMAND(
|
||||
OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/command_line_check
|
||||
COMMAND ${CMAKE_COMMAND} -DMARK_FILE=${CMAKE_CURRENT_BINARY_DIR}/check_mark.txt
|
||||
-P ${CMAKE_CURRENT_SOURCE_DIR}/check_mark.cmake
|
||||
COMMAND ${EXECUTABLE_OUTPUT_PATH}/${CMAKE_CFG_INTDIR}/check_command_line
|
||||
COMMAND "${EXECUTABLE_OUTPUT_PATH}/${CMAKE_CFG_INTDIR}/check command line"
|
||||
${CHECK_ARGS} ""
|
||||
VERBATIM
|
||||
COMMENT "Checking custom command line escapes (single'quote)"
|
||||
|
@ -375,7 +380,7 @@ SET_SOURCE_FILES_PROPERTIES(${CMAKE_CURRENT_BINARY_DIR}/command_line_check
|
|||
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
|
||||
COMMAND "${EXECUTABLE_OUTPUT_PATH}/${CMAKE_CFG_INTDIR}/check command line"
|
||||
${CHECK_ARGS} ""
|
||||
VERBATIM
|
||||
COMMENT "Checking custom target command line escapes ($dollar-signs$)"
|
||||
|
|
Loading…
Reference in New Issue