CMake: Turn LLVM_ENABLE_LIBXML2 into a tri-state option
ClosedPublic

Authored by hans on Tue, Nov 14, 2:21 PM.

Details

Summary

In addition to the current ON and OFF options, this adds the FORCE_ON
option, which causes a configuration error if libxml2 cannot be used.

Diff Detail

Repository
rL LLVM
hans created this revision.Tue, Nov 14, 2:21 PM
hans added a comment.Tue, Nov 14, 2:23 PM

I tested locally that if there's a current LLVM_ENABLE_LIBXML2:BOOL in CMakeCache.txt, that doesn't break things. There is no warning or error, it just seems to ignore the new string option and use the cached bool one.

So I guess this means it won't disrupt current builds, and builds that want to use FORCE_ON need to nuke their cache and reconfigure, which is expected.

rnk accepted this revision.Tue, Nov 14, 2:25 PM

lgtm

cmake/config-ix.cmake
163 ↗(On Diff #122913)

I guess the string value OFF evaluates to false in this context? Scary loose typing, batman!

This revision is now accepted and ready to land.Tue, Nov 14, 2:25 PM
hans added inline comments.Tue, Nov 14, 2:32 PM
cmake/config-ix.cmake
163 ↗(On Diff #122913)

Yup, also "0, OFF, NO, FALSE, N, IGNORE, NOTFOUND, the empty string, or ends in the suffix -NOTFOUND" :-)
https://cmake.org/cmake/help/v3.0/command/if.html

This revision was automatically updated to reflect the committed changes.