[CMake] output a string instead of a list

Brandon J. Van Every bvanevery at gmail.com
Mon Jun 12 04:30:33 EDT 2006


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



More information about the CMake mailing list