diff --git a/CMake/LofarGeneral.cmake b/CMake/LofarGeneral.cmake index b72c4c4e76ce66a28b3526673926b4186671b401..8b3d76537acbfd9eee7277da09d7409bb386e6a5 100644 --- a/CMake/LofarGeneral.cmake +++ b/CMake/LofarGeneral.cmake @@ -126,6 +126,18 @@ if(NOT DEFINED LOFAR_GENERAL_INCLUDED) }" HAVE_GETPROTOBYNAME_R) endif(HAVE_NETDB_H) + ## -------------------------------------------------------------------------- + ## Define `STRNLEN', if the strnlen() function exists. + ## -------------------------------------------------------------------------- + check_c_source_compiles(" + #include <string.h> + #include <stdio.h> + int main() { + char *s = \"test\"; + int i = 3; + unsigned l = strnlen(s,i); + }" HAVE_STRNLEN) + ## -------------------------------------------------------------------------- ## Define custom target 'check', so that we can do 'make check', like we did ## with the GNU Autotools. Tests should be added with lofar_add_test(). diff --git a/lofar_config.h.cmake b/lofar_config.h.cmake index bc66715589fb890db06f5b1da9045001c9a40314..901d33f20771617c31a4353b92837aa818243921 100644 --- a/lofar_config.h.cmake +++ b/lofar_config.h.cmake @@ -172,3 +172,6 @@ /* Define to 1 if you have a declaration for the `getprotobyname_r' function. */ #cmakedefine HAVE_GETPROTOBYNAME_R 1 + +/* Define to 1 if you have a declaration for the `strnlen' function. */ +#cmakedefine HAVE_STRNLEN 1