[CMake] output a string instead of a list

Peter Kümmel syntheticpp at gmx.net
Mon Jun 12 04:58:09 EDT 2006


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"

Peter



More information about the CMake mailing list