annotate cmake/FindNSS.cmake @ 633:6c090638b2b4

Use static buffer for module file name. According to the msdn examle the return value of getmodulefilename should be used to indicate success and not the size. And according to comments on that function on Windows 8.1 it does not return the needed size. So better be more robust and just use max_path as a limit.
author Andre Heinecke <andre.heinecke@intevation.de>
date Mon, 23 Jun 2014 15:29:48 +0200
parents fe86c45755d8
children a974b61a5cce
rev   line source
224
689b94dd89a9 Wrote FindNSS to build against nss without pkg-config support (Windows).
Sascha Wilde <wilde@intevation.de>
parents:
diff changeset
1 # - Try to find Mozilla NSS
689b94dd89a9 Wrote FindNSS to build against nss without pkg-config support (Windows).
Sascha Wilde <wilde@intevation.de>
parents:
diff changeset
2
689b94dd89a9 Wrote FindNSS to build against nss without pkg-config support (Windows).
Sascha Wilde <wilde@intevation.de>
parents:
diff changeset
3 include(FindPkgConfig)
689b94dd89a9 Wrote FindNSS to build against nss without pkg-config support (Windows).
Sascha Wilde <wilde@intevation.de>
parents:
diff changeset
4 # FIXME: maybe a minimal version would be wise...
689b94dd89a9 Wrote FindNSS to build against nss without pkg-config support (Windows).
Sascha Wilde <wilde@intevation.de>
parents:
diff changeset
5 pkg_check_modules (NSS nss)
689b94dd89a9 Wrote FindNSS to build against nss without pkg-config support (Windows).
Sascha Wilde <wilde@intevation.de>
parents:
diff changeset
6
689b94dd89a9 Wrote FindNSS to build against nss without pkg-config support (Windows).
Sascha Wilde <wilde@intevation.de>
parents:
diff changeset
7 if (NOT NSS_FOUND)
689b94dd89a9 Wrote FindNSS to build against nss without pkg-config support (Windows).
Sascha Wilde <wilde@intevation.de>
parents:
diff changeset
8 set(NSS_INCLUDES nss.h nspr.h)
689b94dd89a9 Wrote FindNSS to build against nss without pkg-config support (Windows).
Sascha Wilde <wilde@intevation.de>
parents:
diff changeset
9 set(NSS_LIBS nss3 nssutil3 smime3 ssl3 plds4 plc4 nspr4)
689b94dd89a9 Wrote FindNSS to build against nss without pkg-config support (Windows).
Sascha Wilde <wilde@intevation.de>
parents:
diff changeset
10
689b94dd89a9 Wrote FindNSS to build against nss without pkg-config support (Windows).
Sascha Wilde <wilde@intevation.de>
parents:
diff changeset
11 foreach(include ${NSS_INCLUDES})
689b94dd89a9 Wrote FindNSS to build against nss without pkg-config support (Windows).
Sascha Wilde <wilde@intevation.de>
parents:
diff changeset
12
689b94dd89a9 Wrote FindNSS to build against nss without pkg-config support (Windows).
Sascha Wilde <wilde@intevation.de>
parents:
diff changeset
13 find_path(NSS_${include}_INCLUDE ${include}
345
fe86c45755d8 Add another hint for nss include lookup.
Andre Heinecke <andre.heinecke@intevation.de>
parents: 224
diff changeset
14 HINTS ${NSS_INCLUDEDIR}
fe86c45755d8 Add another hint for nss include lookup.
Andre Heinecke <andre.heinecke@intevation.de>
parents: 224
diff changeset
15 ${NSS_INCLUDEDIR}/nspr)
224
689b94dd89a9 Wrote FindNSS to build against nss without pkg-config support (Windows).
Sascha Wilde <wilde@intevation.de>
parents:
diff changeset
16
689b94dd89a9 Wrote FindNSS to build against nss without pkg-config support (Windows).
Sascha Wilde <wilde@intevation.de>
parents:
diff changeset
17 if(NSS_${include}_INCLUDE)
689b94dd89a9 Wrote FindNSS to build against nss without pkg-config support (Windows).
Sascha Wilde <wilde@intevation.de>
parents:
diff changeset
18 set(NSS_INCLUDE_DIRS ${NSS_INCLUDE_DIRS};${NSS_${include}_INCLUDE})
689b94dd89a9 Wrote FindNSS to build against nss without pkg-config support (Windows).
Sascha Wilde <wilde@intevation.de>
parents:
diff changeset
19 else(NSS_${include}_INCLUDE)
689b94dd89a9 Wrote FindNSS to build against nss without pkg-config support (Windows).
Sascha Wilde <wilde@intevation.de>
parents:
diff changeset
20 message(STATUS "Could not find NSS include: ${include}")
689b94dd89a9 Wrote FindNSS to build against nss without pkg-config support (Windows).
Sascha Wilde <wilde@intevation.de>
parents:
diff changeset
21 return()
689b94dd89a9 Wrote FindNSS to build against nss without pkg-config support (Windows).
Sascha Wilde <wilde@intevation.de>
parents:
diff changeset
22 endif(NSS_${include}_INCLUDE)
689b94dd89a9 Wrote FindNSS to build against nss without pkg-config support (Windows).
Sascha Wilde <wilde@intevation.de>
parents:
diff changeset
23
689b94dd89a9 Wrote FindNSS to build against nss without pkg-config support (Windows).
Sascha Wilde <wilde@intevation.de>
parents:
diff changeset
24 endforeach(include)
689b94dd89a9 Wrote FindNSS to build against nss without pkg-config support (Windows).
Sascha Wilde <wilde@intevation.de>
parents:
diff changeset
25
689b94dd89a9 Wrote FindNSS to build against nss without pkg-config support (Windows).
Sascha Wilde <wilde@intevation.de>
parents:
diff changeset
26 foreach(lib ${NSS_LIBS})
689b94dd89a9 Wrote FindNSS to build against nss without pkg-config support (Windows).
Sascha Wilde <wilde@intevation.de>
parents:
diff changeset
27
689b94dd89a9 Wrote FindNSS to build against nss without pkg-config support (Windows).
Sascha Wilde <wilde@intevation.de>
parents:
diff changeset
28 find_library(NSS_${lib}_LIBRARIE ${lib}
689b94dd89a9 Wrote FindNSS to build against nss without pkg-config support (Windows).
Sascha Wilde <wilde@intevation.de>
parents:
diff changeset
29 HINTS ${NSS_LIBDIR})
689b94dd89a9 Wrote FindNSS to build against nss without pkg-config support (Windows).
Sascha Wilde <wilde@intevation.de>
parents:
diff changeset
30
689b94dd89a9 Wrote FindNSS to build against nss without pkg-config support (Windows).
Sascha Wilde <wilde@intevation.de>
parents:
diff changeset
31 if(NSS_${lib}_LIBRARIE)
689b94dd89a9 Wrote FindNSS to build against nss without pkg-config support (Windows).
Sascha Wilde <wilde@intevation.de>
parents:
diff changeset
32 set(NSS_LIBRARIES ${NSS_LIBRARIES};${NSS_${lib}_LIBRARIE})
689b94dd89a9 Wrote FindNSS to build against nss without pkg-config support (Windows).
Sascha Wilde <wilde@intevation.de>
parents:
diff changeset
33 else(NSS_${lib}_LIBRARIE)
689b94dd89a9 Wrote FindNSS to build against nss without pkg-config support (Windows).
Sascha Wilde <wilde@intevation.de>
parents:
diff changeset
34 message(STATUS "Could not find NSS library: ${lib}")
689b94dd89a9 Wrote FindNSS to build against nss without pkg-config support (Windows).
Sascha Wilde <wilde@intevation.de>
parents:
diff changeset
35 return()
689b94dd89a9 Wrote FindNSS to build against nss without pkg-config support (Windows).
Sascha Wilde <wilde@intevation.de>
parents:
diff changeset
36 endif(NSS_${lib}_LIBRARIE)
689b94dd89a9 Wrote FindNSS to build against nss without pkg-config support (Windows).
Sascha Wilde <wilde@intevation.de>
parents:
diff changeset
37
689b94dd89a9 Wrote FindNSS to build against nss without pkg-config support (Windows).
Sascha Wilde <wilde@intevation.de>
parents:
diff changeset
38 endforeach(lib)
689b94dd89a9 Wrote FindNSS to build against nss without pkg-config support (Windows).
Sascha Wilde <wilde@intevation.de>
parents:
diff changeset
39
689b94dd89a9 Wrote FindNSS to build against nss without pkg-config support (Windows).
Sascha Wilde <wilde@intevation.de>
parents:
diff changeset
40 include(FindPackageHandleStandardArgs)
689b94dd89a9 Wrote FindNSS to build against nss without pkg-config support (Windows).
Sascha Wilde <wilde@intevation.de>
parents:
diff changeset
41
689b94dd89a9 Wrote FindNSS to build against nss without pkg-config support (Windows).
Sascha Wilde <wilde@intevation.de>
parents:
diff changeset
42 find_package_handle_standard_args(NSS
689b94dd89a9 Wrote FindNSS to build against nss without pkg-config support (Windows).
Sascha Wilde <wilde@intevation.de>
parents:
diff changeset
43 REQUIRED_VARS NSS_INCLUDE_DIRS NSS_LIBRARIES
689b94dd89a9 Wrote FindNSS to build against nss without pkg-config support (Windows).
Sascha Wilde <wilde@intevation.de>
parents:
diff changeset
44 )
689b94dd89a9 Wrote FindNSS to build against nss without pkg-config support (Windows).
Sascha Wilde <wilde@intevation.de>
parents:
diff changeset
45 endif (NOT NSS_FOUND)

http://wald.intevation.org/projects/trustbridge/