[CMake] output a string instead of a list
Brandon J. Van Every
bvanevery at gmail.com
Mon Jun 12 05:04:33 EDT 2006
Peter Kümmel wrote:
> Peter Kümmel wrote:
>
>> Brandon J. Van Every wrote:
>>
>>> This is driving me nuts. I have a list of compiler flags:
>>>
>>> GET_DIRECTORY_PROPERTY(EXCESSIVE_CPPFLAGS_LIST
>>> DIRECTORY ${Chicken_SOURCE_DIR}
>>> DEFINITIONS
>>> )
>>>
>>> I want to turn this list into a string with NO SEMICOLONS. I need to
>>> shove this into a .scm file and semicolons won't be appreciated. I keep
>>> trying all these different FOREACH and STRING functions, and nothing
>>> works! I always end up with semicolons. What's the answer? It's like
>>> CMake is too smart about string handling, the double quotes " " always
>>> have side effects. It won't let me manipulate a plain old dumb string.
>>>
>>> This failed:
>>> STRING(REPLACE ";" " " EXCESSIVE_CPPFLAGS "${EXCESSIVE_CPPFLAGS_LIST}")
>>>
>>> This failed:
>>> MACRO(TO_STRING list string)
>>> SET(${string} "")
>>> FOREACH(elem ${${list}})
>>> SET(${string} "${${string}} ${elem}")
>>> ENDFOREACH(elem)
>>> ENDMACRO(TO_STRING)
>>>
>>> Everything I try fails. HEEEELLLLPPPP!!!!!
>>>
>>>
>>> Cheers,
>>> Brandon Van Every
>>>
>> Have you tried "${Chicken_SOURCE_DIR}"?
>>
>> Peter
>>
>
> Sorry, I mean GET_DIRECTORY_PROPERTY("EXCESSIVE_CPPFLAGS_LIST"
>
>
The 1st argument is the VAR I want to dump the results into. That's not
the problem. Assume that EXCESSIVE_CPPFLAGS_LIST contains a whole bunch
of junk separated with semicolons. Getting rid of the semicolons is the
problem.
I wrote a totally separate script and proved that
STRING(REPLACE ";" " " EXCESSIVE_CPPFLAGS "${EXCESSIVE_CPPFLAGS_LIST}")
is supposed to work. Now, is it me or is it CMake...
Cheers,
Brandon Van Every
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://public.kitware.com/pipermail/cmake/attachments/20060612/f818e524/attachment-0001.html
More information about the CMake
mailing list