On Saturday 14 January 2012, Thorsten Wagner wrote:
> Hello,
> how can i enforce that a variable will be defined?

what exactly do you mean ?
Do you want to force the user to set some variable explicitely ?

if(NOT DEFINED SOME_VARIABLE)
  message(FATAL_ERROR "...")
endif()


or put it with some default value in the cache, and then check that it has 
been changed:

set(SOME_VARIABLE "NOTFOUND" CACHE STRING "must be set by the user")

if ("${SOME_VARIABLE}" STREQUAL "NOTFOUND")
  message(FATAL_ERROR "...")
endif()

Is that what you want to do ?

Alex
--

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

Reply via email to