[Beignet] [PATCH] FindLLVM: check for empty system-libs variable

Steven Newbury steve at snewbury.org.uk
Wed Dec 23 08:26:06 PST 2015


When dynamic linking against LLVM, "llvm-config --system-libs" may be
empty.  Add check for a result before attempting to call REGEX REPLACE
with an empty variable.

Signed-off-by: Steven Newbury <steve at snewbury.org.uk>
---
 CMake/FindLLVM.cmake | 2 +++
 1 file changed, 2 insertions(+)

diff --git a/CMake/FindLLVM.cmake b/CMake/FindLLVM.cmake
index a148321..8758026 100644
--- a/CMake/FindLLVM.cmake
+++ b/CMake/FindLLVM.cmake
@@ -99,7 +99,9 @@ execute_process(
   OUTPUT_VARIABLE LLVM_SYSTEM_LIBS_ORIG
   OUTPUT_STRIP_TRAILING_WHITESPACE
 )
+if (LLVM_SYSTEM_LIBS_ORIG)
 string(REGEX REPLACE " *\n" "" LLVM_SYSTEM_LIBS
${LLVM_SYSTEM_LIBS_ORIG})
+endif (LLVM_SYSTEM_LIBS_ORIG)
 endif (LLVM_VERSION_NODOT VERSION_GREATER 34)
 
 macro(add_one_lib name)
-- 
2.6.4
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 181 bytes
Desc: This is a digitally signed message part
URL: <http://lists.freedesktop.org/archives/beignet/attachments/20151223/44723ea7/attachment.sig>


More information about the Beignet mailing list