From: Michael Wallner Date: Mon, 30 Nov 2020 14:36:42 +0000 (+0100) Subject: cmake: fix manual library discovery X-Git-Tag: 1.1.0-beta1~83 X-Git-Url: https://git.m6w6.name/?a=commitdiff_plain;h=8b44ffd00cf562eeb5c603d1b21132f958d67c74;p=m6w6%2Flibmemcached cmake: fix manual library discovery --- diff --git a/CMake/CheckDependency.cmake b/CMake/CheckDependency.cmake index eec8d9b3..7932b55a 100644 --- a/CMake/CheckDependency.cmake +++ b/CMake/CheckDependency.cmake @@ -17,14 +17,14 @@ function(check_dependency NAME LIB) endif() message(STATUS "Checking for library '${LIB}' ...") - find_library(${NAME}_FOUND NAMES ${LIB} ${ARGN}) - if(${NAME}_FOUND) - mark_as_advanced(${NAME}_FOUND) - message(STATUS " Found '${${NAME}_FOUND}'") + find_library(${NAME}_LIB NAMES ${LIB}) + if(${NAME}_LIB) + mark_as_advanced(${NAME}_LIB) + message(STATUS " Found '${${NAME}_LIB}'") set(${NAME}_INCLUDES "") foreach(PATH IN_LIST CMAKE_PREFIX_PATHS) - if(LIB${LIB} MATCHES "^${PATH}") + if(${NAME}_LIB MATCHES "^${PATH}") set(${NAME}_INCLUDES "${PATH}/include") break() endif() @@ -33,7 +33,7 @@ function(check_dependency NAME LIB) add_library(Imported::${NAME} INTERFACE IMPORTED) set_target_properties(Imported::${NAME} PROPERTIES INTERFACE_INCLUDE_DIRECTORIES "${${NAME}_INCLUDES}" - INTERFACE_LINK_LIBRARIES ${${NAME}_FOUND}) + INTERFACE_LINK_LIBRARIES ${${NAME}_LIB}) set(${NAME} Imported::${NAME} CACHE INTERNAL "${NAME} import target") set(${HAVE} 1 CACHE INTERNAL "${HAVE}")