[llvm] r318209 - CMake: Turn LLVM_ENABLE_LIBXML2 into a tri-state option

Hans Wennborg via llvm-commits llvm-commits at lists.llvm.org
Tue Nov 14 14:32:49 PST 2017


Author: hans
Date: Tue Nov 14 14:32:49 2017
New Revision: 318209

URL: http://llvm.org/viewvc/llvm-project?rev=318209&view=rev
Log:
CMake: Turn LLVM_ENABLE_LIBXML2 into a tri-state option

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.

Differential revision: https://reviews.llvm.org/D40050

Modified:
    llvm/trunk/CMakeLists.txt
    llvm/trunk/cmake/config-ix.cmake

Modified: llvm/trunk/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/CMakeLists.txt?rev=318209&r1=318208&r2=318209&view=diff
==============================================================================
--- llvm/trunk/CMakeLists.txt (original)
+++ llvm/trunk/CMakeLists.txt Tue Nov 14 14:32:49 2017
@@ -347,7 +347,7 @@ set(LLVM_TARGET_ARCH "host"
 
 option(LLVM_ENABLE_TERMINFO "Use terminfo database if available." ON)
 
-option(LLVM_ENABLE_LIBXML2 "Use libxml2 if available." ON)
+set(LLVM_ENABLE_LIBXML2 "ON" CACHE STRING "Use libxml2 if available. Can be ON, OFF, or FORCE_ON")
 
 option(LLVM_ENABLE_LIBEDIT "Use libedit if available." ON)
 

Modified: llvm/trunk/cmake/config-ix.cmake
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/cmake/config-ix.cmake?rev=318209&r1=318208&r2=318209&view=diff
==============================================================================
--- llvm/trunk/cmake/config-ix.cmake (original)
+++ llvm/trunk/cmake/config-ix.cmake Tue Nov 14 14:32:49 2017
@@ -170,6 +170,10 @@ if( NOT PURE_WINDOWS AND NOT LLVM_USE_SA
   endif()
 endif()
 
+if (LLVM_ENABLE_LIBXML2 STREQUAL "FORCE_ON" AND NOT LLVM_LIBXML2_ENABLED)
+  message(FATAL_ERROR "Failed to congifure libxml2")
+endif()
+
 check_library_exists(xar xar_open "" HAVE_LIBXAR)
 if(HAVE_LIBXAR)
   set(XAR_LIB xar)




More information about the llvm-commits mailing list