[cmake-developers] [CMake 0012350]: add STRING(ESCAPE) to produce the original string in a CONFIGURE_FILE substitution

Mantis Bug Tracker mantis at public.kitware.com
Tue Jul 19 06:47:58 EDT 2011


The following issue has been SUBMITTED. 
====================================================================== 
http://public.kitware.com/Bug/view.php?id=12350 
====================================================================== 
Reported By:                Flávio J. Saraiva
Assigned To:                
====================================================================== 
Project:                    CMake
Issue ID:                   12350
Category:                   CMake
Reproducibility:            N/A
Severity:                   feature
Priority:                   normal
Status:                     new
====================================================================== 
Date Submitted:             2011-07-19 11:47 WEST
Last Modified:              2011-07-19 11:47 WEST
====================================================================== 
Summary:                    add STRING(ESCAPE) to produce the original string in
a CONFIGURE_FILE substitution
Description: 
string(ESCAPE <string to escape> <output variable>)

It would escape the string, adding surrounding quotes if necessary so that using
the escaped string in a CONFIGURE_FILE substitution would produce the original
string.

Steps to Reproduce: 
see attached file TestEscapeHell.cmake for a test showcasing the problem and a
test with the proposed solution

Additional Information: 
I'm doing CONFIGURE_FILE on the script file CopyIfNotExists.cmake.in to run at
install time.
I have a regex SVN_FOLDER_PATTERN=[\\.]svn that contains a backslash and is
passed on to a variable in the file.

Configuring the file turns: set( SVN_FOLDER_PATTERN @SVN_FOLDER_PATTERN@ )
into: set( SVN_FOLDER_PATTERN [\.]svn )

This obviously generates a parse error: Invalid escape sequence \.
I'm forced to use string(REPLACE) to add escapes and avoid the issue.
====================================================================== 

Issue History 
Date Modified    Username       Field                    Change               
====================================================================== 
2011-07-19 11:47 Flávio J. SaraivaNew Issue                                    
2011-07-19 11:47 Flávio J. SaraivaFile Added: TestEscapeHell.cmake             
      
======================================================================




More information about the cmake-developers mailing list