[CMake] Custom macro problem with boolean
Michael Wild
themiwi at gmail.com
Tue May 3 05:31:45 EDT 2011
On 05/03/2011 11:00 AM, 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})
^^^^^^^
Just use ELSE() here.
> 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
>
Your example works fine for me. Using 2.8.4.
Michael
More information about the CMake
mailing list