[PATCH] D40934: [cmake] Only pass CMAKE_SYSROOT if non-empty
Shoaib Meenai via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Dec 6 17:14:27 PST 2017
smeenai created this revision.
Herald added a subscriber: mgorny.
In my build environment (cmake 3.6.1 and gcc 4.8.5 on CentOS 7), having
an empty CMAKE_SYSROOT in the cache results in --sysroot="" being passed
to all compile commands, and then the compiler errors out because of the
empty sysroot. Only set CMAKE_SYSROOT if non-empty to avoid this.
https://reviews.llvm.org/D40934
Files:
cmake/modules/LLVMExternalProjectUtils.cmake
Index: cmake/modules/LLVMExternalProjectUtils.cmake
===================================================================
--- cmake/modules/LLVMExternalProjectUtils.cmake
+++ cmake/modules/LLVMExternalProjectUtils.cmake
@@ -132,6 +132,10 @@
set(exclude EXCLUDE_FROM_ALL 1)
endif()
+ if(CMAKE_SYSROOT)
+ set(sysroot_arg -DCMAKE_SYSROOT=${CMAKE_SYSROOT})
+ endif()
+
ExternalProject_Add(${name}
DEPENDS ${ARG_DEPENDS} llvm-config
${name}-clobber
@@ -143,7 +147,7 @@
CMAKE_ARGS ${${nameCanon}_CMAKE_ARGS}
${compiler_args}
-DCMAKE_INSTALL_PREFIX=${CMAKE_INSTALL_PREFIX}
- -DCMAKE_SYSROOT=${CMAKE_SYSROOT}
+ ${sysroot_arg}
-DLLVM_BINARY_DIR=${PROJECT_BINARY_DIR}
-DLLVM_CONFIG_PATH=$<TARGET_FILE:llvm-config>
-DLLVM_ENABLE_WERROR=${LLVM_ENABLE_WERROR}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D40934.125852.patch
Type: text/x-patch
Size: 886 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20171207/ce7bd2f9/attachment.bin>
More information about the llvm-commits
mailing list