[CMake] output a string instead of a list

Brandon J. Van Every bvanevery at gmail.com
Mon Jun 12 04:53:03 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}"?
>   

That's not the problem.  I assure you I've got a list of stuff.  Here's 
what finally ends up being substituted into csc.scm.  The part with 
semicolons between the entries is from CMake script substitution.  I 
can't get rid of the semicolons!

$ csc -cflags
-DHAVE_CHICKEN_CONFIG_H 
-DHIERARCHICAL_INSTALL;-DC_USE_C_DEFAULTS;-DC_INSTALL_HOME="E:/Program 
Files/Chicken";-DC_INSTALL_BIN_HOME="E:/Program 
Files/Chicken/bin";-DC_INSTALL_INCLUDE_HOME="E:/Program 
Files/Chicken/include";-DC_INSTALL_LIB_HOME="E:/Program 
Files/Chicken/lib";-DHAVE_DIRECT_H;-DHAVE_GCVT;-DHAVE_STDINT_H;-DHAVE_WINDOWS_H;-DHAVE_LOADLIBRARY;-DHAVE_GETPROCADDRESS;-DHAVE_WINSOCK2_H;-DHAVE_WS2TCPIP_H;-DC_ENABLE_PTABLES;-DC_STACK_GROWS_DOWNWARD=1 
-DC_NO_PIC_NO_DLL -I "E:/Program Files/Chicken/include"



-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://public.kitware.com/pipermail/cmake/attachments/20060612/d432de5d/attachment.htm


More information about the CMake mailing list