[CMake] Dynamic function names
Alexander Neundorf
a.neundorf-work at gmx.net
Mon Feb 2 16:52:53 EST 2009
On Monday 02 February 2009, Nima Talebi wrote:
> Hello,
> I have defined a number of functions, like so...
>
> function(BUILD_HOTWIRE_SERVER)
> ...
> endfunction(BUILD_HOTWIRE_SERVER)
>
>
> Now, based on what user as requested, I'd like to call selected functions
> like so...
>
>
> foreach(COMPONENT ${ONLY})
> if(ENABLE_${COMPONENT})
> message(BUILD_${COMPONENT})
> BUILD_${COMPONENT}()
> endif()
> message(${LINE})
> endforeach(COMPONENT)
>
>
> ...however, cmake does not seem too friendly to the BUILD_${COMPONENT}().
You're correct, this is not supported.
> What should I do?
I think you'll have to use
if()
elseif()
elseif()
...
endif()
Alex
More information about the CMake
mailing list