[CMake] No-op command?

Philip Semanchuk ond at semanchuk.com
Thu Sep 3 11:22:57 EDT 2015


On 9/3/2015 1:59 AM, Petr Kmoch wrote:
> Hi Philip.
>
> You don't need one. This is a perfectly valid piece of CMake code:
>
> if(CMAKE_SYSTEM_NAME STREQUAL "Windows")
> else()
>    ... do something ...
> endif()

Thanks, Petr, that never occurred to me! No wonder I couldn't find it in 
the documentation -- I was looking for something that wasn't there.

Cheers
Philip

>
> Of course, the comment can be put in there, but you don't need any
> commands between an if() and else() (or between any other pair of
> start-end style commands, for that matter).
>
> Petr
>
> On Wed, Sep 2, 2015 at 9:12 PM, Philip Semanchuk <ond at semanchuk.com
> <mailto:ond at semanchuk.com>> wrote:
>
>     Hi there,
>     Does CMake have a no-op command, like 'pass' in Python or ';' in C?
>     I sometimes want to create a construct like this:
>
>     IF(CMAKE_SYSTEM_NAME STREQUAL "Windows")
>          # Under Windows we do nothing because blah blah blah
>          ...no-op...
>     ELSE()
>          ...do something...
>     ENDIF(CMAKE_SYSTEM_NAME STREQUAL "Windows")
>
>
>     Thanks
>     Philip
>     --


More information about the CMake mailing list