[CMake] too many kinds of FALSE
Alexander Neundorf
a.neundorf-work at gmx.net
Sun Dec 16 13:44:42 EST 2007
On Sunday 16 December 2007, Brandon Van Every wrote:
> On Dec 16, 2007 11:57 AM, David Cole <david.cole at kitware.com> wrote:
> > On 12/16/07, Brandon Van Every <bvanevery at gmail.com> wrote:
> > > What's so great about "n" and "no" ?
> >
> > Nobody has claimed that they are great...
> >
> > > I've never used them. Do we
> > > really need to be polluting the interpretation of strings with these
> > > values? What current or legacy code is using them heavily?
> >
> > We cannot know. We can only assume that somebody somewhere is probably
> > using them since they are part of how CMake currently works.
>
> What's an example in the CMake source pool where they're actually used
> for something? Or VTK or ITK? I've never had a reason to use "n" or
> "N".
"n" alone indeed also evaluates to false. Hmm, this really seems like a not so
good idea.
...
> set(myvar)
> if(myvar STREQUAL "")
> message("It would be prudent to initialize myvar, or Bad Things will
> happen.") else(myvar STREQUAL "")
> message("Gosh I'm sure glad I initialized myvar, nothing bad will
> happen!") endif(myvar STREQUAL "")
>
> C:\devel\src\cbugs\strequal>cmake -P strequal.cmake
> void and empty are different
> Gosh I'm sure glad I initialized myvar, nothing bad will happen!
Try the following, this will make it always two strings:
if("${myvar}" STREQUAL "")
Alex
More information about the CMake
mailing list