[CMake] Possible bug in cmake version 2.4-patch 6 with macro argument testing

Trevor Kellaway tkellaway at asl-electronics.co.uk
Mon May 28 13:27:32 EDT 2007


Alan,

Do you concur the following is a real problem?

 <<CMakeLists.txt>> #
# Possible bug in cmake version 2.4-patch 6 where macro arguments
# don't test correctly. When run this produces:
#
# 	mytrue=TRUE [msg1]
# 	MYMACRO(TRUE)
# 	boolarg=TRUE [False path]
# 	_var=TRUE [True path]
#

MACRO (MYMACRO boolarg)
	MESSAGE ("MYMACRO(${boolarg})")
	IF (boolarg)
		MESSAGE ("boolarg=${boolarg} [True path]")
	ELSE (boolarg)
		MESSAGE ("boolarg=${boolarg} [False path]")
	ENDIF (boolarg)

	SET (_var ${boolarg})
	IF (_var)
		MESSAGE ("_var=${_var} [True path]")
	ELSE (_var)
		MESSAGE ("_var=${_var} [False path]")
	ENDIF (_var)
ENDMACRO (MYMACRO boolarg)

SET (mytrue TRUE)
IF (mytrue)
	MESSAGE ("mytrue=${mytrue} [msg1]")
ELSE (mytrue)
	MESSAGE ("mytrue=${mytrue} [msg2]")
ENDIF (mytrue)

MYMACRO(${mytrue})
 
-------------- next part --------------
#
# Possible bug in cmake version 2.4-patch 6 where macro arguments
# don't test correctly. When run this produces:
#
# 	mytrue=TRUE [msg1]
# 	MYMACRO(TRUE)
# 	boolarg=TRUE [False path]
# 	_var=TRUE [True path]
#

MACRO (MYMACRO boolarg)
	MESSAGE ("MYMACRO(${boolarg})")
	IF (boolarg)
		MESSAGE ("boolarg=${boolarg} [True path]")
	ELSE (boolarg)
		MESSAGE ("boolarg=${boolarg} [False path]")
	ENDIF (boolarg)

	SET (_var ${boolarg})
	IF (_var)
		MESSAGE ("_var=${_var} [True path]")
	ELSE (_var)
		MESSAGE ("_var=${_var} [False path]")
	ENDIF (_var)
ENDMACRO (MYMACRO boolarg)

SET (mytrue TRUE)
IF (mytrue)
	MESSAGE ("mytrue=${mytrue} [msg1]")
ELSE (mytrue)
	MESSAGE ("mytrue=${mytrue} [msg2]")
ENDIF (mytrue)

MYMACRO(${mytrue})



More information about the CMake mailing list