Re: [CMake] CMake 2.8.1 / Win: Neither if nor else?`

2010-05-22 Thread Droscy
Hi Torsten

Torsten Rohlfing ha scritto:
 IF(ZLIB_FOUND)
   MESSAGE( WARNING HAVE system zlib )
 ELSEIF(ZLIB_FOUND)
   MESSAGE( WARNING NO system zlib )
 ENDIF(ZLIB_FOUND)

 [...]

 Can someone explain to me what I am missing?
You are not missing anything, simply you are wrongly using the IF
construct because the second command should be ELSE, not ELSEIF.

Your construct can be interpreted like this one
IF(ZLIB_FOUND)
MESSAGE( WARNING HAVE system zlib )
ELSE(ZLIB_FOUND)
IF(ZLIB_FOUND)
MESSAGE( WARNING NO system zlib )
ENDIF(ZLIB_FOUND)
ENDIF(ZLIB_FOUND)
so, of course you get no output if zlib is not found, and two outputs if
zlib is found.

The right construct is
IF(ZLIB_FOUND)
MESSAGE( WARNING HAVE system zlib )
ELSE(ZLIB_FOUND)
MESSAGE( WARNING NO system zlib )
ENDIF(ZLIB_FOUND)


Bye
Droscy


___
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


Re: [CMake] CMake 2.8.1 / Win: Neither if nor else?`

2010-05-22 Thread Philip Lowman
On Sat, May 22, 2010 at 4:50 AM, Droscy drosc...@yahoo.it wrote:

 The right construct is
 IF(ZLIB_FOUND)
MESSAGE( WARNING HAVE system zlib )
 ELSE(ZLIB_FOUND)
 MESSAGE( WARNING NO system zlib )
 ENDIF(ZLIB_FOUND)


And if compatibility with CMake  2.4.4 isn't a concern, an even better way
to do this is:

# set this at your topmost CMakeLists.txt
set(CMAKE_ALLOW_LOOSE_LOOP_CONSTRUCTS true)

if(ZLIB_FOUND)
   message(HAVE system zlib)
else()
   message(NO system zlib)
endif()

P.S.
The WARNING option to message() is new to CMake 2.8.  For
better compatibility with CMake 2.6 and lower, simply omit it which should
give you a similar effect.

-- 
Philip Lowman
___
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

Re: [CMake] CMake 2.8.1 / Win: Neither if nor else?`

2010-05-21 Thread Tyler Roscoe
On Fri, May 21, 2010 at 02:04:38PM -0700, Torsten Rohlfing wrote:
 FIND_PACKAGE(ZLIB)
 IF(ZLIB_FOUND)
   MESSAGE( WARNING HAVE system zlib )
 ELSEIF(ZLIB_FOUND)
   MESSAGE( WARNING NO system zlib )
 ENDIF(ZLIB_FOUND)

I don't see an else clause here, just two ifs (that check the same
condition).

tyler
___
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