(Arf, re-send with an account that's allowed to post to the list...)

On 2017-01-04 14:52, Parag Chandra wrote:
> If I’m not mistaken, when a library cannot be found, the value of
> the variable “ARMADILLO” will be set to “ARMADILLO-NOTFOUND”.

Correct. But...

> So I think you need to adjust your test to:
> 
> IF (${ARMADILLO} STREQUAL “ARMADILLO-NOTFOUND”)
>   # do what you want
> ENDIF ()

CMake treats several strings as having the Boolean value 'false',
including "FALSE" (duh), "0", "OFF", and anything that ends with
"-NOTFOUND". So, it's clearer to just write `if(NOT ARMADILLO)`.

(That said, note that it is convention to name variables that receive
the location of a library like ARMADILLO_LIBRARY. Also, uppercase
commands are sooo last decade ;-).)

BTW, avoid writing unquoted variable expansions in `if()`, as they are
subject to multiple expansion that way. (And it's only recently that
quoted values are not subject to expansion!) Instead, just write the
variable name without the `${` and `}`; it will be expanded for you.

-- 
Matthew
-- 

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more 
information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/cmake

Reply via email to