# - Try to find the Gcrypt library # Once run this will define # # LIBGCRYPT_FOUND - set if the system has the gcrypt library # LIBGCRYPT_CFLAGS - the required gcrypt compilation flags # LIBGCRYPT_LIBRARIES - the linker libraries needed to use the gcrypt library # # Copyright (c) 2006 Brad Hards # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions # are met: # # 1. Redistributions of source code must retain the copyright # notice, this list of conditions and the following disclaimer. # 2. Redistributions in binary form must reproduce the copyright # notice, this list of conditions and the following disclaimer in the # documentation and/or other materials provided with the distribution. # 3. The name of the author may not be used to endorse or promote products # derived from this software without specific prior written permission. # # THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR # IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES # OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. # IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, # INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT # NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF # THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. # libgcrypt is moving to pkg-config, but earlier version don't have it #search in typical paths for libgcrypt-config FIND_PROGRAM(LIBGCRYPTCONFIG_EXECUTABLE NAMES libgcrypt-config) #reset variables set(LIBGCRYPT_LIBRARIES) set(LIBGCRYPT_CFLAGS) # if libgcrypt-config has been found IF(LIBGCRYPTCONFIG_EXECUTABLE) EXEC_PROGRAM(${LIBGCRYPTCONFIG_EXECUTABLE} ARGS --libs RETURN_VALUE _return_VALUE OUTPUT_VARIABLE LIBGCRYPT_LIBRARIES) EXEC_PROGRAM(${LIBGCRYPTCONFIG_EXECUTABLE} ARGS --cflags RETURN_VALUE _return_VALUE OUTPUT_VARIABLE LIBGCRYPT_CFLAGS) IF(${LIBGCRYPT_CFLAGS} MATCHES "\n") SET(LIBGCRYPT_CFLAGS " ") ENDIF(${LIBGCRYPT_CFLAGS} MATCHES "\n") IF(LIBGCRYPT_LIBRARIES AND LIBGCRYPT_CFLAGS) SET(LIBGCRYPT_FOUND TRUE) ENDIF(LIBGCRYPT_LIBRARIES AND LIBGCRYPT_CFLAGS) ENDIF(LIBGCRYPTCONFIG_EXECUTABLE) if (LIBGCRYPT_FOUND) if (NOT LibGcrypt_FIND_QUIETLY) message(STATUS "Found libgcrypt: ${LIBGCRYPT_LIBRARIES}") endif (NOT LibGcrypt_FIND_QUIETLY) else (LIBGCRYPT_FOUND) if (LibGcrypt_FIND_REQUIRED) message(FATAL_ERROR "Could not find libgcrypt libraries") endif (LibGcrypt_FIND_REQUIRED) endif (LIBGCRYPT_FOUND) MARK_AS_ADVANCED(LIBGCRYPT_CFLAGS LIBGCRYPT_LIBRARIES)