[CMake] Custom macro problem with boolean

Miguel Bernabeu mukik182 at gmail.com
Tue May 3 05:00:46 EDT 2011


Hi there,

I have a problem recently in a project I'm trying to port to CMake. My
installed CMake version is 2.8.4 from Debian testing. I require version
2.6.2 as a minimum and CMAKE_ALLOW_LOOSE_LOOP_CONSTRUCTS is set to TRUE.

This is my macro:

MACRO(ENGINE_LIST engine enginestring)
    if(${engine})
        set(ENABLED_ENGINES "${ENABLED_ENGINES}${enginestring}\n")
    elseif(NOT ${engine})
        set(NOTENABLED_ENGINES "${NOTENABLED_ENGINES}${enginestring}\n")
    endif()
ENDMACRO(ENGINE_LIST)

This macro takes boolean parameter, selected or not in the configuraction
menu, and a string. If it is true, the string is added to a list of enabled
engines, if not, to a list of not enabled engines.

Example:

set(SCUMMVM_ENGINE_AGI FALSE CACHE BOOL "Build the AGI Engine")
engine_list(SCUMMVM_ENGINE_AGI "Build the AGI Engine")

message(STATUS "Enabled:"\n\n)
message(STATUS "${ENABLED_ENGINES}\n")
message(STATUS "Not Enabled:"\n\n)
message(STATUS "${NOTENABLED_ENGINES}\n")

The problem is that no matter if SCUMMVM_ENGINE_AGI is true or false, it is
always caught in the ELSE clause. I've tried everything I could think of but
I find myself lost. Could anyone point me to the flaw I'm unable to see?

Thank you,
Miguel
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20110503/43f6f3e6/attachment.htm>


More information about the CMake mailing list