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
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@334747
91177308-0d34-0410-b5e6-
96231b3b80d8
# If libxml2 is available, make it available for c-index-test.
if (CLANG_HAVE_LIBXML)
- include_directories(SYSTEM ${LIBXML2_INCLUDE_DIR})
+ if ((CMAKE_OSX_SYSROOT) AND (EXISTS ${CMAKE_OSX_SYSROOT}/${LIBXML2_INCLUDE_DIR}))
+ include_directories(SYSTEM ${CMAKE_OSX_SYSROOT}/${LIBXML2_INCLUDE_DIR})
+ else()
+ include_directories(SYSTEM ${LIBXML2_INCLUDE_DIR})
+ endif()
target_link_libraries(c-index-test PRIVATE ${LIBXML2_LIBRARIES})
endif()