Hi Bill,

behaviour. Don't break that as you can always use
 if (NOT DEFINED VAR)
   set (VAR "foo" CACHE ...... FORCE)


But:

find_library(FOO_VAR foo)

This will set FOO_VAR (in the cache) if it is not set

or if the value has -NOTFOUND in it.

I just tried it and find_path (didn't try find_library but find_path) will not set it if the cache has -NOTFOUND in it. Please try yourself because I think this one is unexpected, and undocumented.

But let's say I did the test wrong (hopefully) and it is as you said.
Even then this is much more important IMO:

set(FOO_VAR somevalue)

and

set(FOO_VAR somevalue CACHE TYPE "")

are inconsistent.

That's much harder to understand.

Also, the SET documention only mentions the critically important fact that cached values are not overwritten by default when the FORCE option is explained. IMO this is the wrong way to document such an odd behaviour for a command named SET (I don't think I ever seen a language with such a behaviour, and I've been in this business for a long long time).
At the very least that fact should be stated up front.

Best

Fernando

_______________________________________________
CMake mailing list
CMake@cmake.org
http://www.cmake.org/mailman/listinfo/cmake

Reply via email to