Add find_library_and_header() macro for cmake scripts to further

validate installed dependencies.
This commit is contained in:
casey langen 2023-07-30 12:46:26 -07:00
parent 974864470e
commit 9965708858
3 changed files with 18 additions and 5 deletions

View File

@ -1,4 +1,17 @@
macro(find_vendor_library target_var library_name)
find_library(${target_var} NAMES ${library_name} PATHS ${VENDOR_LINK_DIRECTORIES} NO_DEFAULT_PATH)
message(STATUS "[find-vendor-library] '${library_name}' resolved to '${${target_var}}'")
find_library(${target_var} NAMES ${library_name} PATHS ${VENDOR_LINK_DIRECTORIES} NO_DEFAULT_PATH NO_CACHE)
message(STATUS "[find-vendor-library] ${BoldBlue}'${library_name}' library resolved to '${${target_var}}'${ColorReset}")
endmacro(find_vendor_library)
macro(find_library_and_header target_var library_name header_name)
find_library(${target_var} NAMES ${library_name} NO_CACHE)
message(STATUS "[find-library-and-header] ${BoldBlue}'${library_name}' library resolved to '${${target_var}}'${ColorReset}")
find_path(TEMP ${header_name} REQUIRED NO_CACHE)
if (${TEMP} MATCHES "TEMP-NOTFOUND")
message(STATUS "[find-library-and-header] ${BoldRed}'${header_name}' COULD NOT BE FOUND!${ColorReset}")
else()
message(STATUS "[find-library-and-header] ${BoldBlue}'${header_name}' resolved to '${TEMP}'${ColorReset}")
endif()
unset(TEMP)
endmacro(find_library_and_header)

View File

@ -89,8 +89,8 @@ else()
find_library(LIBCRYPTO NAMES crypto PATHS ${VENDOR_LINK_DIRECTORIES})
endif()
find_library(LIBZ NAMES z)
find_library(PTHREAD NAMES pthread)
find_library_and_header(LIBZ z zlib.h)
find_library_and_header(PTHREAD pthread pthread.h)
set(musikcube_LINK_LIBS ${DEFAULT_OS_SYSTEM_LIBS} ${LIBCURL} ${LIBSSL} ${LIBCRYPTO} ${LIBZ} ${PTHREAD})

View File

@ -20,7 +20,7 @@ else()
find_library(LIBGNUTLS NAMES gnutls)
set(EXTRA_LIBS "${LIBGNUTLS}")
endif()
find_library(LIBMICROHTTPD NAMES microhttpd)
find_library_and_header(LIBMICROHTTPD microhttpd microhttpd.h)
endif()
find_library(LIBZ NAMES z)