[CMake] Problem with multiple expressions with if()

Tom Kacvinsky tom.kacvinsky at vectorcast.com
Fri May 15 13:05:31 EDT 2015


On Fri, May 15, 2015 at 12:12 PM, Domen Vrankar <domen.vrankar at gmail.com>
wrote:

> > if ((${CMAKE_SYSTEM_NAME} MATCHES "SunOS") or (DEFINED LINUX64))
> >   message(STATUS "On Solaris or 64 bit Linux")
> > endif()
> > # ====================================================[
> >
> > I'm using cmake version 2.8.11.2 built from source on
> >
> > Linux localhost.localdomain 2.6.18-8.el5 #1 SMP Thu Mar 15 19:46:53 EDT
> 2007
> > x86_64 x86_64 x86_64 GNU/Linux
> >
> > This doesn't work.  I get this error message is:
> >
> > CMake Error at CMakeLists.txt:12 (if):
> >   if given arguments:
> >
> >     "(" "Linux" "MATCHES" "SunOS" ")" "or" "(" "DEFINED" "LINUX64" ")"
> >
> >   Unknown arguments specified
> >
> >
> > What am I doing wrong?  Is this syntax not supported until the 3.x
> series?
>
> Commands are case sensitive so OR should be upper cased.
> Also I would recommand you either use "${var_name}" or var_name as the
> command expects either a string or a variable.
>
> Regards,
> Domen
>

Ah, that did it.  Changing to uppercase OR fixed the issue.  Many thanks.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/cmake/attachments/20150515/d3a1541f/attachment.html>


More information about the CMake mailing list