From 79516a6aa3e875c8d9f4c83667076aa070fe5d6e Mon Sep 17 00:00:00 2001 From: Christian Beier Date: Fri, 10 Aug 2018 17:09:35 +0200 Subject: [PATCH] CMake: make get_link_libraries() not crash when there are no linked libraries at all --- CMakeLists.txt | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 86038d5..a0f1537 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -617,7 +617,9 @@ function(get_link_libraries OUT TARGET) endforeach() list(REMOVE_DUPLICATES RESULT) string(CONCAT RESULT ${RESULT}) # back to string - string(REPLACE "-l" " -l" RESULT ${RESULT}) # re-add separators + if(RESULT) + string(REPLACE "-l" " -l" RESULT ${RESULT}) # re-add separators + endif(RESULT) set(${OUT} ${RESULT} PARENT_SCOPE) endfunction()