[PATCH] D41622: [cmake] Fix path and flag problems when cross compiling.

Don Hinton via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Dec 28 21:33:21 PST 2017


hintonda created this revision.
hintonda added reviewers: EricWF, compnerd, phosek, vkalintiris, beanz.
Herald added a subscriber: mgorny.

When cross compiling, users can set CMAKE_FIND_ROOT_PATH to
the sysroot of the TARGET system which adds the sysroot prefix to the
paths used in the FIND_XXX commands.  Since these FIND_PATH commands
use absolute paths found on the HOST system, pass
NO_CMAKE_FIND_ROOT_PATH to keep the prefix from being added.

Don't overwrite CMAKE_REQUIRED_FLAGS when adding temporary flags.


Repository:
  rCXX libc++

https://reviews.llvm.org/D41622

Files:
  CMakeLists.txt
  cmake/Modules/CheckLibcxxAtomic.cmake


Index: cmake/Modules/CheckLibcxxAtomic.cmake
===================================================================
--- cmake/Modules/CheckLibcxxAtomic.cmake
+++ cmake/Modules/CheckLibcxxAtomic.cmake
@@ -9,7 +9,7 @@
 
 function(check_cxx_atomics varname)
   set(OLD_CMAKE_REQUIRED_FLAGS ${CMAKE_REQUIRED_FLAGS})
-  set(CMAKE_REQUIRED_FLAGS "-nodefaultlibs -std=c++11 -nostdinc++ -isystem ${LIBCXX_SOURCE_DIR}/include")
+  set(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} -nodefaultlibs -std=c++11 -nostdinc++ -isystem ${LIBCXX_SOURCE_DIR}/include")
   if (${LIBCXX_GCC_TOOLCHAIN})
     set(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} --gcc-toolchain=${LIBCXX_GCC_TOOLCHAIN}")
   endif()
Index: CMakeLists.txt
===================================================================
--- CMakeLists.txt
+++ CMakeLists.txt
@@ -123,6 +123,7 @@
           ${LLVM_MAIN_SRC_DIR}/runtimes/libcxxabi/include
           ${LLVM_MAIN_SRC_DIR}/../libcxxabi/include
     NO_DEFAULT_PATH
+    NO_CMAKE_FIND_ROOT_PATH
   )
   if (LIBCXX_TARGETING_MSVC)
     # FIXME: Figure out how to configure the ABI library on Windows.


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D41622.128314.patch
Type: text/x-patch
Size: 1102 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20171229/9bc70445/attachment.bin>


More information about the cfe-commits mailing list