MantisBT - CMake
View Issue Details
0008727CMakeCMakepublic2009-03-12 00:262016-06-10 14:30
Derek Bruening 
Brad King 
normalminoralways
closedmoved 
CMake-2-6 
 
0008727: quoted commands in nmake makefiles mess up command parameters
There is a bug in nmake that appears if these conditions are met:

1) A command is enclosed in quotes
2) The first parameter to that command contains a /

nmake adds a space prior to the first / in the first parameter, if the command is in quotes. This messes up custom commands invoking ${CMAKE_COMMAND} with -D arguments with no space after the D, and perl commands, etc. where the 1st parameter is a path.

When cmake is first invoked with an 8.3 path, it uses that path initially for CMAKE_COMMAND, but on any later re-build of the generated makefiles, it switches to the full installed name, which typically has a space in it and thus becomes quoted.

I suggest that cmake use 8.3 paths in nmake commands, instead of quoting commands with spaces. If 8.3 names are disabled on the local NTFS, an alternative is to use cmd /c "command with spaces".

To see the nmake bug in action try the Makefile below.

# Test case for issue 0000084
# This is a bug in nmake.exe where nmake adds space before 1st / in
# 1st arg to a command, if that command is invoked with quotes.
# Observe:
# % nmake /nologo noquotes
# back\forward/slash second/arg
# % nmake /nologo quotes
# back\forward /slash second/arg
# % nmake /nologo quotescmd
# back\forward/slash second/arg
# This behavior is present in all versions I've tested:
# 8.00.50727.762
# 7.10.3077
# 6.00.8168.0
.PHONY : noquotes quotes quotescmd
noquotes:
    @e:/cygwin/bin/echo back\forward/slash second/arg
quotes:
    @"e:/cygwin/bin/echo" back\forward/slash second/arg
quotescmd:
    @cmd /c "e:/cygwin/bin/echo" back\forward/slash second/arg
No tags attached.
Issue History
2009-03-12 00:26Derek BrueningNew Issue
2009-03-15 22:21Bill HoffmanStatusnew => assigned
2009-03-15 22:21Bill HoffmanAssigned To => Brad King
2012-08-13 10:37Brad KingStatusassigned => backlog
2012-08-13 10:37Brad KingNote Added: 0030539
2016-06-10 14:27Kitware RobotNote Added: 0041515
2016-06-10 14:27Kitware RobotStatusbacklog => resolved
2016-06-10 14:27Kitware RobotResolutionopen => moved
2016-06-10 14:30Kitware RobotStatusresolved => closed

Notes
(0030539)
Brad King   
2012-08-13 10:37   
Sending issues I'm not actively working on to the backlog to await someone with time for them.

If an issue you care about is sent to the backlog when you feel it should have been addressed in a different manner, please bring it up on the CMake mailing list for discussion. Sign up for the mailing list here, if you're not already on it:

 http://www.cmake.org/mailman/listinfo/cmake [^]

It's easy to re-activate a bug here if you can find a CMake developer or contributor who has the bandwidth to take it on.
(0041515)
Kitware Robot   
2016-06-10 14:27   
Resolving issue as `moved`.

This issue tracker is no longer used. Further discussion of this issue may take place in the current CMake Issues page linked in the banner at the top of this page.