[CMake] Strange escaping of cache variables

Julien Bigot julien at julien-bigot.fr
Mon Jun 24 08:03:19 EDT 2013


Hi,

I'm trying to make a module to find out how to "stringify" a symbol in Fortran 
preprocessing.
With most compiler you would write #SYMBOL as in C, but with gfortran, you 
have to use 'SYMBOL' (but it between single quotes)

I've written a module that uses try_run (bad for cross compiling but I didn't 
find any other solution) that writes the correct solution to cache with
set(FPP_STRINGIFY_SYMBOL "${FOUND_SYMBOL}" CACHE STRING
    "Stringyfication symbol for the Fortran Preprocessor")
The problem is that some sort of escaping seems to be applied ...
When${FOUND_SYMBOL} contains 'SYMBOL' what's written to cache is SYMBOL 
(without the quotes)

I've worked around the problem by adding spaces (writing " ${FOUND_SYMBOL} " 
instead) But I'd like to understand what kind of escaping is applied and that 
would be great if it was actually documented.

Regards,
Julien

-- 
Julien Bigot, Ph.D.  --  http://work.julien-bigot.fr
Maison de la Simulation USR 3441 - bât. 565 - CEA Saclay
91191 Gif-sur-Yvette CEDEX - FRANCE
phone: (+33) 1 69 08 01 75  --  xmpp: jbigot at jabber.org
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 230 bytes
Desc: This is a digitally signed message part.
URL: <http://www.cmake.org/pipermail/cmake/attachments/20130624/56ba434e/attachment.pgp>


More information about the CMake mailing list