From d08fd0182da1ea861ef399a115efd85b698d65d0 Mon Sep 17 00:00:00 2001 From: CHris B Date: Sat, 28 Jan 2017 17:00:07 +0100 Subject: [PATCH] CMake: do not include NOTFOUND libs in pkg-config snippets --- CMakeLists.txt | 3 +++ 1 file changed, 3 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index d2f159a..e658976 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -465,6 +465,9 @@ function(get_link_libraries OUT TARGET) set(RESULT "") get_target_property(LIBRARIES ${TARGET} INTERFACE_LINK_LIBRARIES) foreach(LIB ${LIBRARIES}) + if("${LIB}" MATCHES ".*NOTFOUND.*") + continue() + endif() string(REGEX REPLACE "^.*/lib" "" LIB ${LIB}) # remove leading path and "lib" name prefix string(REGEX REPLACE "-l" "" LIB ${LIB}) # remove leading -l string(REGEX REPLACE "\\.so$" "" LIB ${LIB}) # remove trailing .so