[CMake] environment flag for cmake

Brad King brad.king at kitware.com
Wed Jul 20 10:17:56 EDT 2005


Shaul Kedem wrote:
> Can someone please adivse; how do I add an environment flag for CMake?
> 
> I want this flag to be recognized from the CMakeList.txt file ("IF (FLAG)…").

Switching a build setting off an environment variable is very dangerous. 
  The generated build system contains rules to automatically re-run 
cmake during a build if the build system is out of date.  If the 
environment during the build is different than when CMake was first run 
you will get a different configuration.  You probably want to use the 
OPTION command to create a build switch in the cache.

If you must use an environment variable you can get values with 
"$ENV{VARNAME}".

-Brad


More information about the CMake mailing list