[llvm] r320183 - [cmake] Only pass CMAKE_SYSROOT if non-empty
Shoaib Meenai via llvm-commits
llvm-commits at lists.llvm.org
Fri Dec 8 11:42:47 PST 2017
Author: smeenai
Date: Fri Dec 8 11:42:47 2017
New Revision: 320183
URL: http://llvm.org/viewvc/llvm-project?rev=320183&view=rev
Log:
[cmake] Only pass CMAKE_SYSROOT if non-empty
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.
Differential Revision: https://reviews.llvm.org/D40934
Modified:
llvm/trunk/cmake/modules/LLVMExternalProjectUtils.cmake
Modified: llvm/trunk/cmake/modules/LLVMExternalProjectUtils.cmake
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/cmake/modules/LLVMExternalProjectUtils.cmake?rev=320183&r1=320182&r2=320183&view=diff
==============================================================================
--- llvm/trunk/cmake/modules/LLVMExternalProjectUtils.cmake (original)
+++ llvm/trunk/cmake/modules/LLVMExternalProjectUtils.cmake Fri Dec 8 11:42:47 2017
@@ -132,6 +132,10 @@ function(llvm_ExternalProject_Add name s
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 @@ function(llvm_ExternalProject_Add name s
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}
More information about the llvm-commits
mailing list