r334747 - [CMAKE][c-index-test] Honor CMAKE_OSX_SYSROOT to compute include dir for libxml2
Bruno Cardoso Lopes via cfe-commits
cfe-commits at lists.llvm.org
Thu Jun 14 11:20:04 PDT 2018
Author: bruno
Date: Thu Jun 14 11:20:04 2018
New Revision: 334747
URL: http://llvm.org/viewvc/llvm-project?rev=334747&view=rev
Log:
[CMAKE][c-index-test] 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:
cfe/trunk/tools/c-index-test/CMakeLists.txt
Modified: cfe/trunk/tools/c-index-test/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/c-index-test/CMakeLists.txt?rev=334747&r1=334746&r2=334747&view=diff
==============================================================================
--- cfe/trunk/tools/c-index-test/CMakeLists.txt (original)
+++ cfe/trunk/tools/c-index-test/CMakeLists.txt Thu Jun 14 11:20:04 2018
@@ -40,7 +40,11 @@ set_target_properties(c-index-test
# 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()
More information about the cfe-commits
mailing list