[CMake] Custom macro problem with boolean

Miguel Bernabeu mukik182 at gmail.com
Tue May 3 05:32:53 EDT 2011


Hi,

Yes, I'm sorry, I already use

 engine_list(${SCUMMVM_ENGINE_AGI} "Build the AGI Engine")

Same problem still. My mistake to not include it here.

Thank you Jakob,
Miguel

2011/5/3 J.S. van Bethlehem <j.s.van.bethlehem at astro.rug.nl>

> Miguel Bernabeu wrote:
>
>> 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(NOT ENABLED_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
>>
> Given what seems to be your goal with this template, my first guess would
> be that you need to call the macro as:
>
> engine_list(${SCUMMVM_ENGINE_AGI} "Build the AGI Engine")
>
> Jakob
>
> _______________________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
>
> Please keep messages on-topic and check the CMake FAQ at:
> http://www.cmake.org/Wiki/CMake_FAQ
>
> Follow this link to subscribe/unsubscribe:
> http://www.cmake.org/mailman/listinfo/cmake
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20110503/d363c3f8/attachment.htm>


More information about the CMake mailing list