[cmake-developers] FindX11 change breaks complex test

Brad King brad.king at kitware.com
Wed Aug 15 16:33:04 EDT 2012


On 08/15/2012 04:28 PM, Rolf Eike Beer wrote:
> For the empty variable: it looks like an empty variable and a not existing one 
> are the same.

They are not the same:

$ cat var.cmake
macro(report)
  if(DEFINED A)
    message("yes")
  else()
    message("no")
  endif()
endmacro()
set(A "")
report()
set(A)
report()

$ cmake -P var.cmake
yes
no

> Is there a sane way to query this or should I just ignore it anyway?

If mf->GetDefinition() returns NULL then the variable is not set.
If it returns an empty string then the variable is empty.

-Brad



More information about the cmake-developers mailing list