Mercurial > trustbridge
changeset 224:689b94dd89a9
Wrote FindNSS to build against nss without pkg-config support (Windows).
author | Sascha Wilde <wilde@intevation.de> |
---|---|
date | Thu, 27 Mar 2014 17:00:01 +0100 |
parents | d29997e09177 |
children | be22e9deca88 |
files | cinst/CMakeLists.txt cinst/mozilla.c cmake/FindNSS.cmake |
diffstat | 3 files changed, 51 insertions(+), 9 deletions(-) [+] |
line wrap: on
line diff
--- a/cinst/CMakeLists.txt Thu Mar 27 12:46:46 2014 +0100 +++ b/cinst/CMakeLists.txt Thu Mar 27 17:00:01 2014 +0100 @@ -25,12 +25,10 @@ # ---------------------------------------------------------------------- # Mozilla nss store specific certificate installer: -include(FindPkgConfig) -# FIXME: maybe a minimal version would be wise... -pkg_check_modules (NSS nss) -include_directories(${NSS_INCLUDE_DIRS}) +find_package(NSS) if(NSS_FOUND) + include_directories(${NSS_INCLUDE_DIRS}) set(MOZILLA_SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/mozilla.c )
--- a/cinst/mozilla.c Thu Mar 27 12:46:46 2014 +0100 +++ b/cinst/mozilla.c Thu Mar 27 17:00:01 2014 +0100 @@ -49,10 +49,10 @@ * */ #include <dirent.h> -#include <nss/cert.h> -#include <nss/certt.h> -#include <nss/nss.h> -#include <nss/pk11pub.h> +#include <cert.h> +#include <certt.h> +#include <nss.h> +#include <pk11pub.h> #include <stdbool.h> #include <stdio.h> #include <stdlib.h> @@ -264,7 +264,7 @@ CERTCertList *list; CERTCertListNode *node; char *name; - + if (NSS_Initialize(confdir, "", "", "secmod.db", NSS_INIT_READONLY) == SECSuccess) {
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/cmake/FindNSS.cmake Thu Mar 27 17:00:01 2014 +0100 @@ -0,0 +1,44 @@ +# - Try to find Mozilla NSS + +include(FindPkgConfig) +# FIXME: maybe a minimal version would be wise... +pkg_check_modules (NSS nss) + +if (NOT NSS_FOUND) + set(NSS_INCLUDES nss.h nspr.h) + set(NSS_LIBS nss3 nssutil3 smime3 ssl3 plds4 plc4 nspr4) + + foreach(include ${NSS_INCLUDES}) + + find_path(NSS_${include}_INCLUDE ${include} + HINTS ${NSS_INCLUDEDIR}) + + if(NSS_${include}_INCLUDE) + set(NSS_INCLUDE_DIRS ${NSS_INCLUDE_DIRS};${NSS_${include}_INCLUDE}) + else(NSS_${include}_INCLUDE) + message(STATUS "Could not find NSS include: ${include}") + return() + endif(NSS_${include}_INCLUDE) + + endforeach(include) + + foreach(lib ${NSS_LIBS}) + + find_library(NSS_${lib}_LIBRARIE ${lib} + HINTS ${NSS_LIBDIR}) + + if(NSS_${lib}_LIBRARIE) + set(NSS_LIBRARIES ${NSS_LIBRARIES};${NSS_${lib}_LIBRARIE}) + else(NSS_${lib}_LIBRARIE) + message(STATUS "Could not find NSS library: ${lib}") + return() + endif(NSS_${lib}_LIBRARIE) + + endforeach(lib) + + include(FindPackageHandleStandardArgs) + + find_package_handle_standard_args(NSS + REQUIRED_VARS NSS_INCLUDE_DIRS NSS_LIBRARIES + ) +endif (NOT NSS_FOUND)