[PATCH] D94491: [llvm] [cmake] Do not inject /usr/local paths when crosscompiling

Michał Górny via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jan 12 04:47:36 PST 2021


mgorny created this revision.
mgorny added reviewers: krytarowski, emaste, theraven, trombonehero.
Herald added a subscriber: arichardson.
mgorny requested review of this revision.
Herald added a project: LLVM.

Restrict the /usr/local path injection for FreeBSD and DragonflyBSD
to apply only when not crosscompiling.  The injected paths are wrong
in the latter case.


https://reviews.llvm.org/D94491

Files:
  llvm/CMakeLists.txt


Index: llvm/CMakeLists.txt
===================================================================
--- llvm/CMakeLists.txt
+++ llvm/CMakeLists.txt
@@ -911,12 +911,12 @@
 # (this is a variable that CrossCompile sets on recursive invocations)
 endif()
 
-if(${CMAKE_SYSTEM_NAME} MATCHES "(FreeBSD|DragonFly)")
+if(${CMAKE_SYSTEM_NAME} MATCHES "(FreeBSD|DragonFly)" AND NOT CMAKE_CROSSCOMPILING)
   # On FreeBSD, /usr/local/* is not used by default. In order to build LLVM
   # with libxml2, iconv.h, etc., we must add /usr/local paths.
   include_directories(SYSTEM "/usr/local/include")
   link_directories("/usr/local/lib")
-endif(${CMAKE_SYSTEM_NAME} MATCHES "(FreeBSD|DragonFly)")
+endif(${CMAKE_SYSTEM_NAME} MATCHES "(FreeBSD|DragonFly)" AND NOT CMAKE_CROSSCOMPILING)
 
 if( ${CMAKE_SYSTEM_NAME} MATCHES SunOS )
    # special hack for Solaris to handle crazy system sys/regset.h


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D94491.316062.patch
Type: text/x-patch
Size: 878 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210112/6118b9af/attachment.bin>


More information about the llvm-commits mailing list