[CMake] platform independence '

Micha Renner Micha.Renner at t-online.de
Thu Apr 30 04:05:21 EDT 2009


Hi,

The following code example works very well with Windows.

ADD_CUSTOM_COMMAND(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/atkmarshal.h
	COMMAND cmake -E echo "#define Brom &&"
	COMMENT "-- gmarshalAtk Done") 

ADD_CUSTOM_TARGET(BuildGmarshal_ATK ALL DEPENDS
${CMAKE_CURRENT_BINARY_DIR}/atkmarshal.h)

It echos: #define Brom &&.

On Linux I have two problems:

1. "#" is interpreted as comment sign, so there is no output
   COMMAND cmake -E "'#'define... solves this problem, but then
   I have problems on Windows. The output is '#'define Brom...
2. "&&" confuses the shell. make aborts.
   COMMAND cmake -E "'#'define Brom '&&'" works, but on Windows the 
   output looks like this '#'define Brom '&&'

My question is: Is there platform-independent way to solve these
problems.

Micha





More information about the CMake mailing list