Brandon J. Van Every wrote:
SET_TARGET_PROPERTIES(file PROPERTIES COMPILE_FLAGS
 "-DBLAH -DBLLAH -DBLLAAHH")

is a very common form that will be used heavily by people in CMake 2.3 onwards. Anybody who has to do lotsa trivial combos of libraries will be doing it; for instance, shared vs. static libraries, and debug vs. release libraries.

If you use configured headers alot of the need for defining symbols on the compile line goes away. You just need one macro to tell sources when they are building inside a DLL, and CMake automatically provides it (and it can be set with the DEFINE_SYMBOL property).

> The quotes around the flags are necessary because
items in a PROPERTIES list have to come in pairs. I humbly submit that the following syntax would be of great use to people:

SET_COMPILE_FLAGS(file -DBLAH -DBLLAH -DBLLAAHH)

so that they don't have to be "quote paranoid" about everything, and also have less to type. I would have created a macro for this, but my 5 minute perusal of the docs did not yield a painless way to manipulate ARGV. On the positive side, at least I finally understood at an intuitive level what Scheme's CAR and CDR are for. (It's so you can knock the front off the arguments.)

We cannot add a command for every property. You can do it in a macro using something like

MACRO(MY_SET_COMPILE_FLAGS TARGET)
  SET(FLAGS)
  FOREACH(flag ${ARGN})
    SET(FLAGS "${FLAGS} ${flag}")
  ENDOREACH(flag)
  SET_TARGET_PROPERTIES(${TARGET} PROPERTIES COMPILE_FLAGS "${FLAGS}")
ENDMACRO(MY_SET_COMPILE_FLAGS)

Note the documentation of the MACRO command says that ARGN contains all arguments beyond the explicit argument list.

-Brad
_______________________________________________
CMake mailing list
[email protected]
http://www.cmake.org/mailman/listinfo/cmake

Reply via email to