On Fri, Sep 14, 2012 at 4:17 PM, Bogdan Cristea <[email protected]> wrote: > On Friday 14 September 2012 16:13:16 Davis Ford wrote: >> if("$ENV{FOO_HOME}" MATCHES "") >> message("You must set FOO_HOME") >> return() >> endif() > > Try something like this > > if(NOT ENV{FOO_HOME}) > message("etc") > endif() > > -- > Bogdan > -- > > 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
I would use the double quotes like you had originally, but use STREQUAL instead of MATCHES. Or use MATCHES "^$" to match ONLY the explicitly empty string, because MATCHES "" basically matches everything because everything "contains" the empty string... HTH, David -- 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
