[llvm] r334746 - [CMAKE] Honor CMAKE_OSX_SYSROOT to compute include dir for libxml2

Bruno Cardoso Lopes via llvm-commits llvm-commits at lists.llvm.org
Thu Jun 14 11:19:54 PDT 2018


Author: bruno
Date: Thu Jun 14 11:19:54 2018
New Revision: 334746

URL: http://llvm.org/viewvc/llvm-project?rev=334746&view=rev
Log:
[CMAKE] Honor CMAKE_OSX_SYSROOT to compute include dir for libxml2

On MacOS, if CMAKE_OSX_SYSROOT is used and the user has command line tools
installed, we currently get the include path for libxml2 as
/usr/include/libxml2, instead of ${CMAKE_OSX_SYSROOT}/usr/include/libxml2.

Make it consistent on MacOS by prefixing ${CMAKE_OSX_SYSROOT} when
possible.

rdar://problem/41103601

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

Modified: llvm/trunk/cmake/config-ix.cmake
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/cmake/config-ix.cmake?rev=334746&r1=334745&r2=334746&view=diff
==============================================================================
--- llvm/trunk/cmake/config-ix.cmake (original)
+++ llvm/trunk/cmake/config-ix.cmake Thu Jun 14 11:19:54 2018
@@ -148,7 +148,11 @@ if(NOT LLVM_USE_SANITIZER MATCHES "Memor
       find_package(LibXml2)
       if (LIBXML2_FOUND)
         set(LLVM_LIBXML2_ENABLED 1)
-        include_directories(${LIBXML2_INCLUDE_DIR})
+        if ((CMAKE_OSX_SYSROOT) AND (EXISTS ${CMAKE_OSX_SYSROOT}/${LIBXML2_INCLUDE_DIR}))
+          include_directories(${CMAKE_OSX_SYSROOT}/${LIBXML2_INCLUDE_DIR})
+        else()
+          include_directories(${LIBXML2_INCLUDE_DIR})
+        endif()
         set(LIBXML2_LIBS "xml2")
       endif()
     endif()




More information about the llvm-commits mailing list