[CMake] SET_SOURCE_FILES_PROPERTY and multiple args

James Bigler bigler at cs.utah.edu
Tue Jul 17 15:51:11 EDT 2007


I have some code that sets a property and then I try to get it out later.  This 
property is some customized flags to the program:

SET(MY_FLAGS_VAL "-Wall;-w512;-DSCI_NOPERSISTENT")

SET_SOURCE_FILES_PROPERTIES(myfile.w PROPERTIES MY_FLAGS ${MY_FLAGS_VAL})
GET_SOURCE_FILE_PROPERTY(myflags myfile.w MY_FLAGS)
MESSAGE("myfile.w:MY_FLAGS = ${myflags}")

The problem I'm having is that only the first flag ("-Wall") gets set.  The rest 
are ignored.

When I specify the flags explicitly it works fine:
SET_SOURCE_FILES_PROPERTIES(myfile.w PROPERTIES MY_FLAGS 
"-Wall;-w512;-DSCI_NOPERSISTENT")

I tried this:

SET(MY_FLAGS_VAL "-Wall -w512 -DSCI_NOPERSISTENT")

But CMake replaced the spaces with '\ ' making the three args one arg.

Is it possible to set a source file property with a variable's value?

I'm using CMake 2.4.6 on linux.

Thanks,
James




More information about the CMake mailing list