[CMake] How to test environment variable in IF command

Mike Talbot mtalbot at abingdon.oilfield.slb.com
Thu Jul 19 06:05:19 EDT 2007


Hi,

I'm trying to work out how to test for an environment variable in an IF 
command, the following doesn't work:

SET(ENV{FOO} ON)
MESSAGE("FOO = $ENV{FOO}")    # prints "FOO = ON"
IF(ENV{FOO})
  MESSAGE("FOO is set")
ENDIF(ENV{FOO})

Does anyone know what the right syntax for doing this is, please?

Thanks,
Mike

-- 
Mike Talbot
Core Petrel Architect (Abingdon)
Schlumberger
Lambourn Court, Wyndyke Furlong,
Abingdon Business Park, Abingdon,
Oxfordshire, OX14 1UJ, UK
Office: +44 (0)1235 543 488
Mobile: +44 (0)7790 382 746



More information about the CMake mailing list