# /**************************************************************************** # * # * Copyright (c) 2001 Novell, Inc. All Rights Reserved. # * # * This program is free software; you can redistribute it and/or # * modify it under the terms of version 2 of the GNU General Public License # * as published by the Free Software Foundation. # * # * This program is distributed in the hope that it will be useful, # * but WITHOUT ANY WARRANTY; without even the implied warranty of # * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # * GNU General Public License for more details. # * # * You should have received a copy of the GNU General Public License # * along with this program; if not, contact Novell, Inc. # * # * To contact Novell about this file by physical or electronic mail, you # * may find current contact information at www.novell.com. # * # ****************************************************************************/ find_package(PkgConfig QUIET) if(PkgConfig_FOUND) pkg_check_modules(PC_LDNS QUIET ldns) endif() find_path(LDNS_INCLUDE_DIR NAMES ldns/ldns.h HINTS ${PC_LDNS_INCLUDEDIR} ${PC_LDNS_INCLUDE_DIRS}) find_library(LDNS_LIBRARY NAMES ldns HINTS ${PC_LDNS_LIBDIR} ${PC_LDNS_LIBRARY_DIRS}) set(LDNS_VERSION "${PC_LDNS_VERSION}") if(LDNS_INCLUDE_DIR AND NOT LDNS_VERSION AND EXISTS "${LDNS_INCLUDE_DIR}/ldns/util.h") file(STRINGS "${LDNS_INCLUDE_DIR}/ldns/util.h" _LDNS_VERSION_LINE REGEX "^# *define LDNS_VERSION +\"[0-9]+\\.[0-9]+\\.[0-9]+\"") string(REGEX MATCH "[0-9]+\\.[0-9]+\\.[0-9]+" LDNS_VERSION "${_LDNS_VERSION_LINE}") endif() include(FindPackageHandleStandardArgs) find_package_handle_standard_args(LDNS REQUIRED_VARS LDNS_LIBRARY LDNS_INCLUDE_DIR VERSION_VAR LDNS_VERSION) if(LDNS_FOUND AND NOT TARGET LDNS::LDNS) add_library(LDNS::LDNS UNKNOWN IMPORTED) set_target_properties(LDNS::LDNS PROPERTIES IMPORTED_LOCATION "${LDNS_LIBRARY}" INTERFACE_INCLUDE_DIRECTORIES "${LDNS_INCLUDE_DIR}") if(PC_LDNS_CFLAGS_OTHER) set_property(TARGET LDNS::LDNS PROPERTY INTERFACE_COMPILE_OPTIONS "${PC_LDNS_CFLAGS_OTHER}") endif() endif() mark_as_advanced(LDNS_INCLUDE_DIR LDNS_LIBRARY)