wilde@224: # - Try to find Mozilla NSS
wilde@224: 
wilde@224: include(FindPkgConfig)
wilde@224: # FIXME: maybe a minimal version would be wise...
wilde@224: pkg_check_modules (NSS  nss)
wilde@224: 
wilde@224: if (NOT NSS_FOUND)
wilde@224:   set(NSS_INCLUDES nss.h nspr.h)
wilde@224:   set(NSS_LIBS nss3 nssutil3 smime3 ssl3 plds4 plc4 nspr4)
wilde@224: 
wilde@224:   foreach(include ${NSS_INCLUDES})
wilde@224: 
wilde@224:     find_path(NSS_${include}_INCLUDE ${include}
wilde@224:       HINTS ${NSS_INCLUDEDIR})
wilde@224: 
wilde@224:     if(NSS_${include}_INCLUDE)
wilde@224:       set(NSS_INCLUDE_DIRS ${NSS_INCLUDE_DIRS};${NSS_${include}_INCLUDE})
wilde@224:     else(NSS_${include}_INCLUDE)
wilde@224:       message(STATUS "Could not find NSS include: ${include}")
wilde@224:       return()
wilde@224:     endif(NSS_${include}_INCLUDE)
wilde@224: 
wilde@224:   endforeach(include)
wilde@224: 
wilde@224:   foreach(lib ${NSS_LIBS})
wilde@224: 
wilde@224:     find_library(NSS_${lib}_LIBRARIE ${lib}
wilde@224:       HINTS ${NSS_LIBDIR})
wilde@224: 
wilde@224:     if(NSS_${lib}_LIBRARIE)
wilde@224:       set(NSS_LIBRARIES ${NSS_LIBRARIES};${NSS_${lib}_LIBRARIE})
wilde@224:     else(NSS_${lib}_LIBRARIE)
wilde@224:       message(STATUS "Could not find NSS library: ${lib}")
wilde@224:       return()
wilde@224:     endif(NSS_${lib}_LIBRARIE)
wilde@224: 
wilde@224:   endforeach(lib)
wilde@224: 
wilde@224:   include(FindPackageHandleStandardArgs)
wilde@224: 
wilde@224:   find_package_handle_standard_args(NSS
wilde@224:     REQUIRED_VARS NSS_INCLUDE_DIRS NSS_LIBRARIES
wilde@224:     )
wilde@224: endif (NOT NSS_FOUND)