[cmake-developers] [CMake 0011714]: Directly reading data from a file into variables

Mantis Bug Tracker mantis at public.kitware.com
Mon Jan 17 10:31:55 EST 2011


The following issue has been SUBMITTED. 
====================================================================== 
http://public.kitware.com/Bug/view.php?id=11714 
====================================================================== 
Reported By:                Markus Elfring
Assigned To:                
====================================================================== 
Project:                    CMake
Issue ID:                   11714
Category:                   CMake
Reproducibility:            always
Severity:                   feature
Priority:                   normal
Status:                     new
====================================================================== 
Date Submitted:             2011-01-17 16:31 CET
Last Modified:              2011-01-17 16:31 CET
====================================================================== 
Summary:                    Directly reading data from a file into variables
Description: 
I would like to read some data from a file into CMake variables.

Your programming supports this kind of context-dependent data extraction with
two steps so far.
Example:
1. file(STRINGS ${file_name} ${variable_for_file_data} REGEX ${pattern1})
2. string(REGEX REPLACE ${pattern2} "\\1" ${variable_for_data_element}
${variable_for_file_data})

This proccessing approach requires the evaluation of two similar regular
expressions. This is not as efficient as I imagine it could be.
- I do not really need any replacement features for this use case. It seems that
it is only needed at the moment because the subfunction "string(REGEX REPLACE
...)" is the only one with (partly documented) support for subexpressions in
regular expressions.
- It would be convenient if parts from the input lines could be directly
assigned to variables by the file command.

Would you like to add the capability for improved data selection to a variant of
the function "file(STRINGS ...)"?
====================================================================== 

Issue History 
Date Modified    Username       Field                    Change               
====================================================================== 
2011-01-17 16:31 Markus Elfring New Issue                                    
======================================================================




More information about the cmake-developers mailing list