[cmake-developers] [CMake 0015001]: add_custom_command: inconsistent treatment of escaped quotes

Mantis Bug Tracker mantis at public.kitware.com
Tue Jul 1 17:11:50 EDT 2014


The following issue has been SUBMITTED. 
====================================================================== 
http://public.kitware.com/Bug/view.php?id=15001 
====================================================================== 
Reported By:                George Sakhnovsky
Assigned To:                
====================================================================== 
Project:                    CMake
Issue ID:                   15001
Category:                   CMake
Reproducibility:            always
Severity:                   minor
Priority:                   low
Status:                     new
====================================================================== 
Date Submitted:             2014-07-01 17:11 EDT
Last Modified:              2014-07-01 17:11 EDT
====================================================================== 
Summary:                    add_custom_command: inconsistent treatment of
escaped quotes
Description: 
I have an add_custom_command COMMAND line where I want to wrap several of the
strings in double quotes.

cmake src snippet:

        add_custom_command(
            TARGET ${target_name}
            PRE_BUILD
            COMMAND "\"$(DevEnvDir)tf\"" history "\"$(SolutionDir)\""
/stopafter:1 /recursive > changeset.dat

The generated vcxproj file looks as follows. Note that the escaped double quotes
made it through quite literally:

\"$(DevEnvDir)tf\" history "$(SolutionDir)" /stopafter:1 /recursive >
changeset.dat

The desired behavior is to have $(DevEnvDir)tf wrapped in double quotes like so:

"$(DevEnvDir)tf" history "$(SolutionDir)" /stopafter:1 /recursive >
changeset.dat

Why does escaping double quotes work for the second string in the line but not
the first? Should this be accomplished differently for the first string because
it's the actual command? If this is not a bug, what's the workaround?

====================================================================== 

Issue History 
Date Modified    Username       Field                    Change               
====================================================================== 
2014-07-01 17:11 George SakhnovskyNew Issue                                    
======================================================================



More information about the cmake-developers mailing list