From 5cbd52dbd34ae1e4ffb69b3303dd0886df4c4df3 Mon Sep 17 00:00:00 2001 From: Brad Hards Date: Sat, 2 Dec 2006 11:49:26 +0000 Subject: [PATCH] Update the NSS module so it has a chance to work, and drop in a new Botan module. svn path=/trunk/kdesupport/qca/; revision=609824 --- cmake/modules/FindBotan.cmake | 40 +++++++++++++++++++++++++++++++++++ cmake/modules/FindNss.cmake | 37 +++++++++++--------------------- 2 files changed, 52 insertions(+), 25 deletions(-) create mode 100644 cmake/modules/FindBotan.cmake diff --git a/cmake/modules/FindBotan.cmake b/cmake/modules/FindBotan.cmake new file mode 100644 index 00000000..210736d1 --- /dev/null +++ b/cmake/modules/FindBotan.cmake @@ -0,0 +1,40 @@ + +# - Try to find the Gcrypt library +# Once run this will define +# +# BOTAN_FOUND - set if the system has the gcrypt library +# BOTAN_CFLAGS - the required gcrypt compilation flags +# BOTAN_LIBRARIES - the linker libraries needed to use the gcrypt library +# +# Copyright (c) 2006 Brad Hards +# +# Redistribution and use is allowed according to the terms of the BSD license. +# For details see the accompanying COPYING-CMAKE-SCRIPTS file. + +# libgcrypt is moving to pkg-config, but earlier version don't have it + +#search in typical paths for libgcrypt-config +FIND_PROGRAM(BOTANCONFIG_EXECUTABLE NAMES botan-config PATHS + /usr/bin + /usr/local/bin +) + +#reset variables +set(BOTAN_LIBRARIES) +set(BOTAN_CFLAGS) + +# if botan-config has been found +IF(BOTANCONFIG_EXECUTABLE) + + EXEC_PROGRAM(${BOTANCONFIG_EXECUTABLE} ARGS --libs RETURN_VALUE _return_VALUE OUTPUT_VARIABLE BOTAN_LIBRARIES) + + EXEC_PROGRAM(${BOTANCONFIG_EXECUTABLE} ARGS --cflags RETURN_VALUE _return_VALUE OUTPUT_VARIABLE BOTAN_CFLAGS) + + IF(BOTAN_LIBRARIES) + SET(BOTAN_FOUND TRUE) + message(STATUS "Found Botan: ${BOTAN_LIBRARIES}") + ENDIF(BOTAN_LIBRARIES) + + MARK_AS_ADVANCED(BOTAN_CFLAGS BOTAN_LIBRARIES) + +ENDIF(BOTANCONFIG_EXECUTABLE) diff --git a/cmake/modules/FindNss.cmake b/cmake/modules/FindNss.cmake index 91062a23..90a077e5 100644 --- a/cmake/modules/FindNss.cmake +++ b/cmake/modules/FindNss.cmake @@ -2,7 +2,7 @@ # Once done this will define # # NSS_FOUND - system has mozilla-nss lib -# NSS_INCLUDE_DIR - the mozilla-nss include directory +# NSS_INCLUDE_DIRS - the mozilla-nss include directories # NSS_LIBRARIES - Link these to use mozilla-nss # NSS_DEFINITIONS - Compiler switches required for using NSS # @@ -11,37 +11,24 @@ # Redistribution and use is allowed according to the terms of the BSD license. # For details see the accompanying COPYING-CMAKE-SCRIPTS file. -if (NSS_INCLUDE_DIR AND NSS_LIBRARIES) +if (NSS_INCLUDE_DIRS AND NSS_LIBRARIES) # in cache already SET(NSS_FOUND TRUE) -else (NSS_INCLUDE_DIR AND NSS_LIBRARIES) +else (NSS_INCLUDE_DIRS AND NSS_LIBRARIES) - # use pkg-config to get the directories and then use these values - # in the FIND_PATH() and FIND_LIBRARY() calls INCLUDE(UsePkgConfig) - - PKGCONFIG(mozilla-nss _NSSIncDir _NSSLinkDir _NSSLinkFlags _NSSCflags) - - set(NSS_DEFINITIONS ${_NSSCflags}) - FIND_PATH(NSS_INCLUDE_DIR nss/pk11func.h - ${_NSSIncDir} - /usr/include - /usr/local/include - ) + PKGCONFIG(nss _NSSIncDir _NSSLinkDir _NSSLinkFlags _NSSCflags) + + set(NSS_DEFINITIONS ${_NSSCflags}) + set(NSS_INCLUDE_DIRS ${_NSSIncDir}) + set(NSS_LIBRARIES ${_NSSLinkFlags}) - FIND_LIBRARY(NSS_LIBRARIES NAMES nss3 - PATHS - ${_NSSLinkDir} - /usr/lib - /usr/local/lib - ) - - if (NSS_INCLUDE_DIR AND NSS_LIBRARIES) + if (NSS_INCLUDE_DIRS AND NSS_LIBRARIES) set(NSS_FOUND TRUE) - endif (NSS_INCLUDE_DIR AND NSS_LIBRARIES) + endif (NSS_INCLUDE_DIRS AND NSS_LIBRARIES) if (NSS_FOUND) if (NOT NSS_FIND_QUIETLY) @@ -53,6 +40,6 @@ else (NSS_INCLUDE_DIR AND NSS_LIBRARIES) endif (NSS_FIND_REQUIRED) endif (NSS_FOUND) - MARK_AS_ADVANCED(NSS_INCLUDE_DIR NSS_LIBRARIES) + MARK_AS_ADVANCED(NSS_INCLUDE_DIRS NSS_LIBRARIES) -endif (NSS_INCLUDE_DIR AND NSS_LIBRARIES) +endif (NSS_INCLUDE_DIRS AND NSS_LIBRARIES)