3 # We need 3.12 or later, so that we can set policy CMP0074; see
6 cmake_minimum_required(VERSION 3.12)
11 # if this is a version of CMake less than 3.5, require only
12 # 2.8.12, just in case somebody is configuring with CMake
13 # on a "long-term support" version # of some OS and that
14 # version supplies an older version of CMake;
16 # otherwise, require 3.5, so we don't get messages warning
17 # that support for versions of CMake lower than 3.5 is
20 if(CMAKE_VERSION VERSION_LESS "3.5")
21 cmake_minimum_required(VERSION 2.8.12)
23 cmake_minimum_required(VERSION 3.5)
28 # We want find_path() and find_library() to honor {packagename}_ROOT,
29 # as that appears to be the standard way to say "hey, look here for
30 # this package" from the command line.
33 cmake_policy(SET CMP0074 NEW)
39 # When building on NetBSD, with a libpcap installed from pkgsrc,
40 # a -Wl,-rpath,/usr/pkg/lib option is added to the options when
41 # linking tcpdump. This puts /usr/pkg/lib into the run-time path.
43 # However, by default, CMake adds a rule to the install CMake script
44 # a CMake command (using an undocumented subcommand of file()) that
45 # strips /usr/pkg/lib *out* of the run-time path; the message in the
46 # output for the "install" target is
48 # -- Set runtime path of "{target-directory}/tcpdump" to ""
50 # I am not certain what the rationale is for doing this, but a
51 # *consequence* of this is that, when you run the installed tcpdump,
52 # it fails to find libpcap.so:
54 # $ {target-directory}/tcpdump -h
55 # {target-directory}/tcpdump: Shared object "libpcap.so.0" not found
57 # It also appears to be the case that, on Ubuntu 22.04, FreeBSD 12,
58 # DragonFly BSD 5.8, OpenBSD 6.6, and Solaris 11.4,
60 # On Ubuntu and Solaris, even if you have a libpcap in /usr/local, you
61 # have to provide not only -I/usr/local/include and -L/usr/local/lib,
62 # you also must provide -Wl,-rpath,/usr/local/lib in order to have
63 # the run-time linker look in /usr/local/lib for libpcap. If it's not
64 # specified, then, if the shared library major version number of the
65 # libpcap in /usr/lib is the same as the shared major version number
66 # of the libpcap in /usr/local/lib, the run-time linker will find the
67 # libpcap in /usr/lib; if the versions are different, the run-time
68 # linker will fail to find the libpcap in /usr/lib, so the program will
71 # We suppress this by setting CMAKE_INSTALL_RPATH_USE_LINK_PATH to TRUE;
72 # as the documentation for that variable says:
74 # Add paths to linker search and installed rpath.
76 # CMAKE_INSTALL_RPATH_USE_LINK_PATH is a boolean that if set to True
77 # will append to the runtime search path (rpath) of installed
78 # binaries any directories outside the project that are in the linker
79 # search path or contain linked library files. The directories are
80 # appended after the value of the INSTALL_RPATH target property.
82 # If, for whatever reason, directories in which we search for external
83 # libraries, other than the standard system library directories, are
84 # added to the executable's rpath in the build process, we most
85 # definitely want them in the installed image's rpath if they are
86 # necessary in order to find the libraries at run time.
88 set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)
90 set(CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake/Modules)
93 # We explicitly indicate what languages are used in tcpdump to avoid
94 # checking for a C++ compiler.
96 # One reason to avoid that check is that there's no need to waste
97 # configuration time performing it.
99 # Another reason is that:
101 # CMake will try to determine the sizes of some data types, including
102 # void *, early in the process of configuration; apparently, it's done
103 # as part of processing the project() command.
105 # At least as of CMake 2.8.6, it does so by checking the size of
106 # "void *" in C, setting CMAKE_C_SIZEOF_DATA_PTR based on that,
107 # setting CMAKE_SIZEOF_VOID_P to that, and then checking the size
108 # of "void *" in C++, setting CMAKE_CXX_SIZEOF_DATA_PTR based on
109 # that, and then setting CMAKE_SIZEOF_VOID_P to *that*.
111 # The compile tests include whatever C flags may have been provided
112 # to CMake in the CFLAGS and CXXFLAGS environment variables.
114 # If you set an architecture flag such as -m32 or -m64 in CFLAGS
115 # but *not* in CXXFLAGS, the size for C++ will win, and hilarity
118 # Or if, at least on Solaris, you have a newer version of GCC
119 # installed, but *not* a newer version of G++, and you have Oracle
120 # Studio installed, it will find GCC, which will default to building
121 # 64-bit, and Oracle Studio's C++ compiler, which will default to
122 # building 32-bit, the size for C++ will win, and, again, hilarity
128 # For checking if a compiler flag works and adding it if it does.
130 include(CheckCCompilerFlag)
131 macro(check_and_add_compiler_option _option)
132 message(STATUS "Checking C compiler flag ${_option}")
133 string(REPLACE "=" "-" _temp_option_variable ${_option})
134 string(REGEX REPLACE "^-" "" _option_variable ${_temp_option_variable})
135 check_c_compiler_flag("${_option}" ${_option_variable})
136 if(${${_option_variable}})
137 set(C_ADDITIONAL_FLAGS "${C_ADDITIONAL_FLAGS} ${_option}")
142 # If we're building with Visual Studio, we require Visual Studio 2015,
143 # in order to get sufficient C99 compatibility. Check for that.
145 # If not, try the appropriate flag for the compiler to enable C99
148 set(C_ADDITIONAL_FLAGS "")
150 if(MSVC_VERSION LESS 1900)
151 message(FATAL_ERROR "Visual Studio 2015 or later is required")
155 # Treat source files as being in UTF-8 with MSVC if it's not using
156 # the Clang front end.
157 # We assume that UTF-8 source is OK with other compilers and with
158 # MSVC if it's using the Clang front end.
160 if(NOT ${CMAKE_C_COMPILER} MATCHES "clang*")
161 set(C_ADDITIONAL_FLAGS "${C_ADDITIONAL_FLAGS} /utf-8")
162 endif(NOT ${CMAKE_C_COMPILER} MATCHES "clang*")
165 # Try to enable as many C99 features as we can.
166 # At minimum, we want C++/C99-style // comments.
168 # Newer versions of compilers might default to supporting C99, but
169 # older versions may require a special flag.
171 # Prior to CMake 3.1, setting CMAKE_C_STANDARD will not have any effect,
172 # so, unless and until we require CMake 3.1 or later, we have to do it
173 # ourselves on pre-3.1 CMake, so we just do it ourselves on all versions
176 # Note: with CMake 3.1 through 3.5, the only compilers for which CMake
177 # handles CMAKE_C_STANDARD are GCC and Clang. 3.6 adds support only
178 # for Intel C; 3.9 adds support for PGI C, Sun C, and IBM XL C, and
179 # 3.10 adds support for Cray C and IAR C, but no version of CMake has
180 # support for HP C. Therefore, even if we use CMAKE_C_STANDARD with
181 # compilers for which CMake supports it, we may still have to do it
182 # ourselves on other compilers.
184 # See the CMake documentation for the CMAKE_<LANG>_COMPILER_ID variables
185 # for a list of compiler IDs.
187 # XXX - this just tests whether the option works and adds it if it does.
188 # We don't test whether it's necessary in order to get the C99 features
189 # that we use; if we ever have a user who tries to compile with a compiler
190 # that can't be made to support those features, we can add a test to make
191 # sure we actually *have* C99 support.
193 if(CMAKE_C_COMPILER_ID MATCHES "GNU" OR
194 CMAKE_C_COMPILER_ID MATCHES "Clang")
195 check_and_add_compiler_option("-std=gnu99")
196 elseif(CMAKE_C_COMPILER_ID MATCHES "XL")
198 # We want support for extensions picked up for GNU C compatibility,
199 # so we use -qlanglvl=extc99.
201 check_and_add_compiler_option("-qlanglvl=extc99")
202 elseif(CMAKE_C_COMPILER_ID MATCHES "HP")
203 check_and_add_compiler_option("-AC99")
204 elseif(CMAKE_C_COMPILER_ID MATCHES "Sun")
205 check_and_add_compiler_option("-xc99")
206 elseif(CMAKE_C_COMPILER_ID MATCHES "Intel")
207 check_and_add_compiler_option("-c99")
211 set(LIBRARY_NAME netdissect)
213 ###################################################################
215 ###################################################################
217 option(WITH_SMI "Build with libsmi, if available" ON)
218 option(WITH_CRYPTO "Build with OpenSSL/libressl libcrypto, if available" ON)
219 option(WITH_CAPSICUM "Build with Capsicum security functions, if available" ON)
220 option(WITH_CAP_NG "Use libcap-ng, if available" ON)
221 option(ENABLE_SMB "Build with the SMB dissector" OFF)
224 # String parameters. Neither of them are set, initially; only if the
225 # user explicitly configures them are they set.
227 # WITH_CHROOT is STRING, not PATH, as the directory need not exist
230 set(WITH_CHROOT CACHE STRING
231 "Directory to which to chroot when dropping privileges")
232 set(WITH_USER CACHE STRING
233 "User to whom to set the UID when dropping privileges")
236 # By default, build universal with the appropriate set of architectures
237 # for the OS on which we're doing the build.
239 if(APPLE AND "${CMAKE_OSX_ARCHITECTURES}" STREQUAL "")
241 # Get the major version of Darwin.
243 string(REGEX MATCH "^([0-9]+)" SYSTEM_VERSION_MAJOR "${CMAKE_SYSTEM_VERSION}")
245 if(SYSTEM_VERSION_MAJOR EQUAL 9)
247 # Leopard. Build for x86 and 32-bit PowerPC, with
248 # x86 first. (That's what Apple does.)
250 set(CMAKE_OSX_ARCHITECTURES "i386;ppc")
251 elseif(SYSTEM_VERSION_MAJOR EQUAL 10)
253 # Snow Leopard. Build for x86-64 and x86, with
254 # x86-64 first. (That's what Apple does.)
256 set(CMAKE_OSX_ARCHITECTURES "x86_64;i386")
260 ###################################################################
262 ###################################################################
264 # Get, parse, format and set tcpdump's version string from
265 # [tcpdump_root]/VERSION for later use.
267 # Get MAJOR, MINOR, PATCH & SUFFIX
268 file(STRINGS ${tcpdump_SOURCE_DIR}/VERSION
270 LIMIT_COUNT 1 # Read only the first line
273 ######################################
275 ######################################
277 add_definitions(-DHAVE_CONFIG_H)
280 ${CMAKE_CURRENT_BINARY_DIR}
281 ${tcpdump_SOURCE_DIR}
285 add_definitions(-D__STDC__)
286 add_definitions(-D_CRT_SECURE_NO_WARNINGS)
291 MESSAGE(STATUS "Use STATIC runtime")
293 set (CMAKE_CXX_FLAGS_MINSIZEREL "${CMAKE_CXX_FLAGS_MINSIZEREL} /MT")
294 set (CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO} /MT")
295 set (CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /MT")
296 set (CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} /MTd")
298 set (CMAKE_C_FLAGS_MINSIZEREL "${CMAKE_C_FLAGS_MINSIZEREL} /MT")
299 set (CMAKE_C_FLAGS_RELWITHDEBINFO "${CMAKE_C_FLAGS_RELWITHDEBINFO} /MT")
300 set (CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} /MT")
301 set (CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} /MTd")
303 MESSAGE(STATUS "Use DYNAMIC runtime")
305 set (CMAKE_CXX_FLAGS_MINSIZEREL "${CMAKE_CXX_FLAGS_MINSIZEREL} /MD")
306 set (CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO} /MD")
307 set (CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /MD")
308 set (CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} /MDd")
310 set (CMAKE_C_FLAGS_MINSIZEREL "${CMAKE_C_FLAGS_MINSIZEREL} /MD")
311 set (CMAKE_C_FLAGS_RELWITHDEBINFO "${CMAKE_C_FLAGS_RELWITHDEBINFO} /MD")
312 set (CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} /MD")
313 set (CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} /MDd")
314 endif (USE_STATIC_RT)
317 ###################################################################
318 # Detect available platform features
319 ###################################################################
321 include(CMakePushCheckState)
322 include(CheckIncludeFile)
323 include(CheckIncludeFiles)
324 include(CheckFunctionExists)
325 include(CheckLibraryExists)
326 include(CheckSymbolExists)
327 include(CheckStructHasMember)
328 include(CheckVariableExists)
329 include(CheckTypeSize)
334 check_include_file(fcntl.h HAVE_FCNTL_H)
335 check_include_file(rpc/rpc.h HAVE_RPC_RPC_H)
336 check_include_file(net/if.h HAVE_NET_IF_H)
338 check_include_files("rpc/rpc.h;rpc/rpcent.h" HAVE_RPC_RPCENT_H)
339 endif(HAVE_RPC_RPC_H)
344 check_function_exists(strlcat HAVE_STRLCAT)
345 check_function_exists(strlcpy HAVE_STRLCPY)
346 check_function_exists(strsep HAVE_STRSEP)
349 # Find library needed for gethostbyaddr.
350 # NOTE: if you hand check_library_exists as its last argument a variable
351 # that's been set, it skips the test, so we need different variables.
353 set(TCPDUMP_LINK_LIBRARIES "")
356 # We need winsock2.h and ws2tcpip.h.
358 cmake_push_check_state()
359 set(CMAKE_REQUIRED_LIBRARIES ws2_32)
360 check_symbol_exists(gethostbyaddr "winsock2.h;ws2tcpip.h" LIBWS2_32_HAS_GETHOSTBYADDR)
361 cmake_pop_check_state()
362 if(LIBWS2_32_HAS_GETHOSTBYADDR)
363 set(TCPDUMP_LINK_LIBRARIES ws2_32 ${TCPDUMP_LINK_LIBRARIES})
364 else(LIBWS2_32_HAS_GETHOSTBYADDR)
365 message(FATAL_ERROR "gethostbyaddr is required, but wasn't found")
366 endif(LIBWS2_32_HAS_GETHOSTBYADDR)
368 check_function_exists(gethostbyaddr STDLIBS_HAVE_GETHOSTBYADDR)
369 if(NOT STDLIBS_HAVE_GETHOSTBYADDR)
370 check_library_exists(socket gethostbyaddr "" LIBSOCKET_HAS_GETHOSTBYADDR)
371 if(LIBSOCKET_HAS_GETHOSTBYADDR)
372 set(TCPDUMP_LINK_LIBRARIES ${TCPDUMP_LINK_LIBRARIES} socket)
373 else(LIBSOCKET_HAS_GETHOSTBYADDR)
374 check_library_exists(nsl gethostbyaddr "" LIBNSL_HAS_GETHOSTBYADDR)
375 if(LIBNSL_HAS_GETHOSTBYADDR)
376 set(TCPDUMP_LINK_LIBRARIES ${TCPDUMP_LINK_LIBRARIES} nsl)
377 else(LIBNSL_HAS_GETHOSTBYADDR)
378 check_library_exists(network gethostbyaddr "" LIBNETWORK_HAS_GETHOSTBYADDR)
379 if(LIBNETWORK_HAS_GETHOSTBYADDR)
380 set(TCPDUMP_LINK_LIBRARIES ${TCPDUMP_LINK_LIBRARIES} network)
381 else(LIBNETWORK_HAS_GETHOSTBYADDR)
382 message(FATAL_ERROR "gethostbyaddr is required, but wasn't found")
383 endif(LIBNETWORK_HAS_GETHOSTBYADDR)
384 endif(LIBNSL_HAS_GETHOSTBYADDR)
385 endif(LIBSOCKET_HAS_GETHOSTBYADDR)
386 endif(NOT STDLIBS_HAVE_GETHOSTBYADDR)
390 # This may require additional libraries.
392 cmake_push_check_state()
393 set(CMAKE_REQUIRED_LIBRARIES ${TCPDUMP_LINK_LIBRARIES})
394 check_function_exists(getservent STDLIBS_HAVE_GETSERVENT)
395 if(STDLIBS_HAVE_GETSERVENT)
396 set(HAVE_GETSERVENT TRUE)
397 else(STDLIBS_HAVE_GETSERVENT)
399 # Some platforms may need -lsocket for getservent.
401 set(CMAKE_REQUIRED_LIBRARIES socket ${TCPDUMP_LINK_LIBRARIES})
402 check_function_exists(getservent LIBSOCKET_HAS_GETSERVENT)
403 if(LIBSOCKET_HAS_GETSERVENT)
404 set(HAVE_GETSERVENT TRUE)
405 set(TCPDUMP_LINK_LIBRARIES socket ${TCPDUMP_LINK_LIBRARIES})
406 endif(LIBSOCKET_HAS_GETSERVENT)
407 endif(STDLIBS_HAVE_GETSERVENT)
408 cmake_pop_check_state()
411 # Make sure we have snprintf(); we require it.
412 # We use check_symbol_exists(), as it isn't necessarily an external
413 # function - in Visual Studio, for example, it is an inline function
414 # calling an external function.
416 check_symbol_exists(snprintf "stdio.h" HAVE_SNPRINTF)
417 if(NOT HAVE_SNPRINTF)
418 message(FATAL_ERROR "snprintf() is required but wasn't found")
422 # Require a proof of suitable snprintf(3), same as in Autoconf.
424 include(CheckCSourceRuns)
425 check_c_source_runs("
428 #include <inttypes.h>
429 #include <sys/types.h>
434 uint64_t t = (uint64_t)1 << 32;
436 snprintf(buf, sizeof(buf), \"%zu\", sizeof(buf));
437 if (strncmp(buf, \"100\", sizeof(buf)))
440 snprintf(buf, sizeof(buf), \"%zd\", -sizeof(buf));
441 if (strncmp(buf, \"-100\", sizeof(buf)))
444 snprintf(buf, sizeof(buf), \"%\" PRId64, -t);
445 if (strncmp(buf, \"-4294967296\", sizeof(buf)))
448 snprintf(buf, sizeof(buf), \"0o%\" PRIo64, t);
449 if (strncmp(buf, \"0o40000000000\", sizeof(buf)))
452 snprintf(buf, sizeof(buf), \"0x%\" PRIx64, t);
453 if (strncmp(buf, \"0x100000000\", sizeof(buf)))
456 snprintf(buf, sizeof(buf), \"%\" PRIu64, t);
457 if (strncmp(buf, \"4294967296\", sizeof(buf)))
466 if(NOT SUITABLE_SNPRINTF)
468 "The snprintf(3) implementation in this libc is not suitable,
469 tcpdump would not work correctly even if it managed to compile."
473 check_function_exists(getopt_long HAVE_GETOPT_LONG)
474 check_function_exists(setlinebuf HAVE_SETLINEBUF)
476 # For Windows, don't need to waste time checking for fork() or vfork().
479 check_function_exists(fork HAVE_FORK)
480 check_function_exists(vfork HAVE_VFORK)
484 # Some platforms may need -lnsl for getrpcbynumber.
486 cmake_push_check_state()
487 set(CMAKE_REQUIRED_LIBRARIES ${TCPDUMP_LINK_LIBRARIES})
488 check_function_exists(getrpcbynumber STDLIBS_HAVE_GETRPCBYNUMBER)
489 if(STDLIBS_HAVE_GETRPCBYNUMBER)
490 set(HAVE_GETRPCBYNUMBER TRUE)
491 else(STDLIBS_HAVE_GETRPCBYNUMBER)
492 set(CMAKE_REQUIRED_LIBRARIES ${TCPDUMP_LINK_LIBRARIES} nsl)
493 check_function_exists(getrpcbynumber LIBNSL_HAS_GETRPCBYNUMBER)
494 if(LIBNSL_HAS_GETRPCBYNUMBER)
495 set(HAVE_GETRPCBYNUMBER TRUE)
496 set(TCPDUMP_LINK_LIBRARIES ${TCPDUMP_LINK_LIBRARIES} nsl)
497 endif(LIBNSL_HAS_GETRPCBYNUMBER)
498 endif(STDLIBS_HAVE_GETRPCBYNUMBER)
499 cmake_pop_check_state()
502 # This requires the libraries we require, as ether_ntohost might be
503 # in one of those libraries. That means we have to do this after
504 # we check for those libraries.
506 # You are in a twisty little maze of UN*Xes, all different.
507 # Some might not have ether_ntohost().
508 # Some might have it and declare it in <net/ethernet.h>.
509 # Some might have it and declare it in <netinet/ether.h>
510 # Some might have it and declare it in <sys/ethernet.h>.
511 # Some might have it and declare it in <arpa/inet.h>.
512 # Some might have it and declare it in <netinet/if_ether.h>.
513 # Some might have it and not declare it in any header file.
515 # Before you is a C compiler.
517 cmake_push_check_state()
518 set(CMAKE_REQUIRED_LIBRARIES ${TCPDUMP_LINK_LIBRARIES})
519 check_function_exists(ether_ntohost HAVE_ETHER_NTOHOST)
520 if(HAVE_ETHER_NTOHOST)
522 # OK, we have ether_ntohost(). We don't check whether it's buggy,
523 # as we assume any system that has CMake is likely to be new enough
524 # that, if it has ether_ntohost(), whatever bug is checked for in
525 # autotools is fixed; we just decide to use it.
527 set(USE_ETHER_NTOHOST TRUE)
530 # Is it declared in <net/ethernet.h>?
532 # This test fails if we don't have <net/ethernet.h> or if we do
533 # but it doesn't declare ether_ntohost().
535 check_symbol_exists(ether_ntohost net/ethernet.h NET_ETHERNET_H_DECLARES_ETHER_NTOHOST)
536 if(NET_ETHERNET_H_DECLARES_ETHER_NTOHOST)
538 # Yes - we have it declared.
540 set(HAVE_DECL_ETHER_NTOHOST TRUE)
545 if(NOT HAVE_DECL_ETHER_NTOHOST)
547 # No - how about <netinet/ether.h>, as on Linux?
549 # This test fails if we don't have <netinet/ether.h>
550 # or if we do but it doesn't declare ether_ntohost().
552 check_symbol_exists(ether_ntohost netinet/ether.h NETINET_ETHER_H_DECLARES_ETHER_NTOHOST)
553 if(NETINET_ETHER_H_DECLARES_ETHER_NTOHOST)
555 # Yes - we have it declared.
557 set(HAVE_DECL_ETHER_NTOHOST TRUE)
563 if(NOT HAVE_DECL_ETHER_NTOHOST)
565 # No - how about <sys/ethernet.h>, as on Solaris 10 and later?
567 # This test fails if we don't have <sys/ethernet.h>
568 # or if we do but it doesn't declare ether_ntohost().
570 check_symbol_exists(ether_ntohost sys/ethernet.h SYS_ETHERNET_H_DECLARES_ETHER_NTOHOST)
571 if(SYS_ETHERNET_H_DECLARES_ETHER_NTOHOST)
573 # Yes - we have it declared.
575 set(HAVE_DECL_ETHER_NTOHOST TRUE)
581 if(NOT HAVE_DECL_ETHER_NTOHOST)
583 # No, how about <arpa/inet.h>, as on AIX?
585 # This test fails if we don't have <arpa/inet.h>
586 # or if we do but it doesn't declare ether_ntohost().
588 check_symbol_exists(ether_ntohost arpa/inet.h ARPA_INET_H_DECLARES_ETHER_NTOHOST)
589 if(ARPA_INET_H_DECLARES_ETHER_NTOHOST)
591 # Yes - we have it declared.
593 set(HAVE_DECL_ETHER_NTOHOST TRUE)
599 if(NOT HAVE_DECL_ETHER_NTOHOST)
601 # No, how about <netinet/if_ether.h>?
602 # On some platforms, it requires <net/if.h> and
603 # <netinet/in.h>, and we always include it with
604 # both of them, so test it with both of them.
606 # This test fails if we don't have <netinet/if_ether.h>
607 # and the headers we include before it, or if we do but
608 # <netinet/if_ether.h> doesn't declare ether_ntohost().
610 check_symbol_exists(ether_ntohost "sys/types.h;sys/socket.h;net/if.h;netinet/in.h;netinet/if_ether.h" NETINET_IF_ETHER_H_DECLARES_ETHER_NTOHOST)
611 if(NETINET_IF_ETHER_H_DECLARES_ETHER_NTOHOST)
613 # Yes - we have it declared.
615 set(HAVE_DECL_ETHER_NTOHOST TRUE)
619 # After all that, is ether_ntohost() declared?
621 if(NOT HAVE_DECL_ETHER_NTOHOST)
623 # No, we'll have to declare it ourselves.
624 # Do we have "struct ether_addr" if we include<netinet/if_ether.h>?
626 check_struct_has_member("struct ether_addr" octet "sys/types.h;sys/socket.h;net/if.h;netinet/in.h;netinet/if_ether.h" HAVE_STRUCT_ETHER_ADDR)
629 cmake_pop_check_state()
634 # XXX - there's no check_struct() macro that's like check_struct_has_member()
635 # except that it only checks for the existence of the structure type,
636 # so we use check_struct_has_member() and look for ss_family.
639 ######################################
640 # External dependencies
641 ######################################
644 # libpcap/WinPcap/Npcap.
647 find_package(PCAP REQUIRED)
648 include_directories(${PCAP_INCLUDE_DIRS})
650 cmake_push_check_state()
655 set(CMAKE_REQUIRED_INCLUDES ${PCAP_INCLUDE_DIRS})
658 # Check whether we have pcap/pcap-inttypes.h.
659 # If we do, we use that to get the C99 types defined.
661 check_include_file(pcap/pcap-inttypes.h HAVE_PCAP_PCAP_INTTYPES_H)
664 # At compile time HAVE_PCAP_FINDALLDEVS depends on HAVE_PCAP_IF_T.
666 cmake_push_check_state()
667 set(CMAKE_EXTRA_INCLUDE_FILES pcap.h)
668 check_type_size(pcap_if_t PCAP_IF_T)
669 cmake_pop_check_state()
672 # Check for various functions in libpcap/WinPcap/Npcap.
674 cmake_push_check_state()
675 set(CMAKE_REQUIRED_LIBRARIES ${PCAP_LIBRARIES})
678 # Check for "pcap_list_datalinks()" and use a substitute version if
679 # it's not present. If it is present, check for "pcap_free_datalinks()";
680 # if it's not present, we don't replace it for now. (We could do so
681 # on UN*X, but not on Windows, where hilarity ensues if a program
682 # built with one version of the MSVC support library tries to free
683 # something allocated by a library built with another version of
684 # the MSVC support library.)
686 check_function_exists(pcap_list_datalinks HAVE_PCAP_LIST_DATALINKS)
687 if(HAVE_PCAP_LIST_DATALINKS)
688 check_function_exists(pcap_free_datalinks HAVE_PCAP_FREE_DATALINKS)
689 endif(HAVE_PCAP_LIST_DATALINKS)
692 # Check for "pcap_datalink_name_to_val()", and use a substitute
693 # version if it's not present. If it is present, check for
694 # "pcap_datalink_val_to_description()", and if we don't have it,
695 # use a substitute version.
697 check_function_exists(pcap_datalink_name_to_val HAVE_PCAP_DATALINK_NAME_TO_VAL)
698 if(HAVE_PCAP_DATALINK_NAME_TO_VAL)
699 check_function_exists(pcap_datalink_val_to_description HAVE_PCAP_DATALINK_VAL_TO_DESCRIPTION)
700 endif(HAVE_PCAP_DATALINK_NAME_TO_VAL)
703 # Check for "pcap_set_datalink()"; you can't substitute for it if
704 # it's absent (it has hooks into libpcap), so just define the
705 # HAVE_ value if it's there.
707 check_function_exists(pcap_set_datalink HAVE_PCAP_SET_DATALINK)
710 # Check for "pcap_breakloop()"; you can't substitute for it if
711 # it's absent (it has hooks into the live capture routines),
712 # so just define the HAVE_ value if it's there.
714 check_function_exists(pcap_breakloop HAVE_PCAP_BREAKLOOP)
717 # Check for "pcap_dump_ftell()"; we use a substitute version
718 # if it's not present.
720 check_function_exists(pcap_dump_ftell HAVE_PCAP_DUMP_FTELL)
723 # Do we have the new open API? Check for pcap_create() and for
724 # pcap_statustostr(), and assume that, if we have both of them,
725 # we also have pcap_activate() and the other new routines
726 # introduced in libpcap 1.0.0. (We check for pcap_statustostr()
727 # as well, because WinPcap 4.1.3 screwed up and exported pcap_create()
728 # but not other routines such as pcap_statustostr(), even though it
729 # defined them and even though you really want pcap_statustostr() to
730 # get strings corresponding to some of the status returns from the
733 check_function_exists(pcap_statustostr HAVE_PCAP_STATUSTOSTR)
735 # If we don't have pcap_statustostr(), don't check for pcap_create(),
736 # so we pretend we don't have it.
738 if(HAVE_PCAP_STATUSTOSTR)
739 check_function_exists(pcap_create HAVE_PCAP_CREATE)
740 endif(HAVE_PCAP_STATUSTOSTR)
743 # OK, do we have pcap_set_tstamp_type? If so, assume we have
744 # pcap_list_tstamp_types and pcap_free_tstamp_types as well.
746 check_function_exists(pcap_set_tstamp_type HAVE_PCAP_SET_TSTAMP_TYPE)
749 # And do we have pcap_set_tstamp_precision? If so, we assume
750 # we also have pcap_open_offline_with_tstamp_precision.
752 check_function_exists(pcap_set_tstamp_precision HAVE_PCAP_SET_TSTAMP_PRECISION)
753 endif(HAVE_PCAP_CREATE)
756 # Check for a miscellaneous collection of functions which we use
759 check_function_exists(pcap_findalldevs HAVE_PCAP_FINDALLDEVS)
760 check_function_exists(pcap_dump_flush HAVE_PCAP_DUMP_FLUSH)
761 check_function_exists(pcap_lib_version HAVE_PCAP_LIB_VERSION)
762 if(NOT HAVE_PCAP_LIB_VERSION)
763 # Check for the pcap_version string variable and set HAVE_PCAP_VERSION
764 endif(NOT HAVE_PCAP_LIB_VERSION)
765 check_function_exists(pcap_setdirection HAVE_PCAP_SETDIRECTION)
766 check_function_exists(pcap_set_immediate_mode HAVE_PCAP_SET_IMMEDIATE_MODE)
767 check_function_exists(pcap_dump_ftell64 HAVE_PCAP_DUMP_FTELL64)
768 check_function_exists(pcap_open HAVE_PCAP_OPEN)
769 check_function_exists(pcap_findalldevs_ex HAVE_PCAP_FINDALLDEVS_EX)
772 # On Windows, check for pcap_wsockinit(); if we don't have it, check for
776 check_function_exists(pcap_wsockinit HAVE_PCAP_WSOCKINIT)
777 if(NOT HAVE_PCAP_WSOCKINIT)
778 check_function_exists(wsockinit HAVE_WSOCKINIT)
779 endif(NOT HAVE_PCAP_WSOCKINIT)
783 # Check for special debugging functions
785 check_function_exists(pcap_set_parser_debug HAVE_PCAP_SET_PARSER_DEBUG)
786 if(NOT HAVE_PCAP_SET_PARSER_DEBUG)
787 # Check whether libpcap defines pcap_debug or yydebug
788 check_variable_exists(pcap_debug HAVE_PCAP_DEBUG)
789 if(NOT HAVE_PCAP_DEBUG)
790 check_variable_exists(yydebug HAVE_YYDEBUG)
791 endif(NOT HAVE_PCAP_DEBUG)
792 endif(NOT HAVE_PCAP_SET_PARSER_DEBUG)
794 check_function_exists(pcap_set_optimizer_debug HAVE_PCAP_SET_OPTIMIZER_DEBUG)
795 check_function_exists(bpf_dump HAVE_BPF_DUMP)
797 cmake_pop_check_state()
798 cmake_pop_check_state()
803 include_directories(SYSTEM ${PCAP_INCLUDE_DIRS})
804 set(TCPDUMP_LINK_LIBRARIES ${PCAP_LIBRARIES} ${TCPDUMP_LINK_LIBRARIES})
807 # Optional libraries.
816 include_directories(SYSTEM ${SMI_INCLUDE_DIRS})
817 set(TCPDUMP_LINK_LIBRARIES ${TCPDUMP_LINK_LIBRARIES} ${SMI_LIBRARIES})
823 # OpenSSL/libressl libcrypto.
829 # Check for some headers and functions.
831 check_include_file(openssl/evp.h HAVE_OPENSSL_EVP_H)
834 # 1) do we have EVP_CIPHER_CTX_new?
835 # If so, we use it to allocate an EVP_CIPHER_CTX, as
836 # EVP_CIPHER_CTX may be opaque; otherwise, we allocate
839 cmake_push_check_state()
840 set(CMAKE_REQUIRED_LIBRARIES "${CRYPTO_LIBRARIES}")
842 check_function_exists(EVP_CIPHER_CTX_new HAVE_EVP_CIPHER_CTX_NEW)
845 # 2) do we have EVP_DecryptInit_ex()?
846 # If so, we use it, because we need to be able to make two
847 # "initialize the cipher" calls, one with the cipher and key,
848 # and one with the IV, and, as of OpenSSL 1.1, You Can't Do That
849 # with EVP_DecryptInit(), because a call to EVP_DecryptInit() will
850 # unconditionally clear the context, and if you don't supply a
851 # cipher, it'll clear the cipher, rendering the context unusable
852 # and causing a crash.
854 check_function_exists(EVP_DecryptInit_ex HAVE_EVP_DECRYPTINIT_EX)
856 cmake_pop_check_state()
861 include_directories(SYSTEM ${CRYPTO_INCLUDE_DIRS})
862 set(TCPDUMP_LINK_LIBRARIES ${TCPDUMP_LINK_LIBRARIES} ${CRYPTO_LIBRARIES})
863 set(HAVE_LIBCRYPTO ON)
868 # Capsicum sandboxing.
869 # Some of this is in the system library, some of it is in other libraries.
872 check_include_files("sys/capsicum.h" HAVE_SYS_CAPSICUM_H)
873 if(HAVE_SYS_CAPSICUM_H)
874 check_function_exists(cap_enter HAVE_CAP_ENTER)
875 check_function_exists(cap_rights_limit HAVE_CAP_RIGHTS_LIMIT)
876 check_function_exists(cap_ioctls_limit HAVE_CAP_IOCTLS_LIMIT)
877 check_function_exists(openat HAVE_OPENAT)
878 if(HAVE_CAP_ENTER AND HAVE_CAP_RIGHTS_LIMIT AND
879 HAVE_CAP_IOCTLS_LIMIT AND HAVE_OPENAT)
881 # OK, we have the functions we need to support Capsicum.
883 set(HAVE_CAPSICUM TRUE)
886 # OK, can we use Casper?
888 check_library_exists(casper cap_init "" HAVE_CAP_INIT)
890 cmake_push_check_state()
891 set(CMAKE_REQUIRED_LIBRARIES casper)
892 check_library_exists(cap_dns cap_gethostbyaddr "" HAVE_CAP_GETHOSTBYADDR)
893 cmake_pop_check_state()
894 if(HAVE_CAP_GETHOSTBYADDR)
895 set(HAVE_CASPER TRUE)
896 set(TCPDUMP_LINK_LIBRARIES ${TCPDUMP_LINK_LIBRARIES} casper cap_dns)
897 endif(HAVE_CAP_GETHOSTBYADDR)
899 endif(HAVE_CAP_ENTER AND HAVE_CAP_RIGHTS_LIMIT AND
900 HAVE_CAP_IOCTLS_LIMIT AND HAVE_OPENAT)
901 endif(HAVE_SYS_CAPSICUM_H)
908 check_include_file(cap-ng.h HAVE_CAP_NG_H)
909 check_library_exists(cap-ng capng_change_id "" HAVE_LIBCAP_NG)
911 set(TCPDUMP_LINK_LIBRARIES ${TCPDUMP_LINK_LIBRARIES} cap-ng)
912 endif(HAVE_LIBCAP_NG)
915 ###################################################################
917 ###################################################################
920 # Check and add warning options if we have a .devel file.
922 if(EXISTS ${CMAKE_SOURCE_DIR}/.devel OR EXISTS ${CMAKE_BINARY_DIR}/.devel)
926 if(MSVC AND NOT ${CMAKE_C_COMPILER} MATCHES "clang*")
928 # MSVC, with Microsoft's front end and code generator.
929 # "MSVC" is also set for Microsoft's compiler with a Clang
930 # front end and their code generator ("Clang/C2"), so we
931 # check for clang.exe and treat that differently.
933 check_and_add_compiler_option(-Wall)
935 # Disable some pointless warnings that /Wall turns on.
937 # Unfortunately, MSVC does not appear to have an equivalent
938 # to "__attribute__((unused))" to mark a particular function
939 # parameter as being known to be unused, so that the compiler
940 # won't warn about it (for example, the function might have
941 # that parameter because a pointer to it is being used, and
942 # the signature of that function includes that parameter).
943 # C++ lets you give a parameter a type but no name, but C
946 check_and_add_compiler_option(-wd4100)
948 # In theory, we care whether somebody uses f() rather than
949 # f(void) to declare a function with no arguments, but, in
950 # practice, there are places in the Windows header files
951 # that appear to do that, so we squelch that warning.
953 check_and_add_compiler_option(-wd4255)
955 # Windows FD_SET() generates this, so we suppress it.
957 check_and_add_compiler_option(-wd4548)
959 # Perhaps testing something #defined to be 0 with #ifdef is an
960 # error, and it should be tested with #if, but perhaps it's
961 # not, and Microsoft does that in its headers, so we squelch
964 check_and_add_compiler_option(-wd4574)
966 # The Windows headers also test not-defined values in #if, so
967 # we don't want warnings about that, either.
969 check_and_add_compiler_option(-wd4668)
971 # We do *not* care whether some function is, or isn't, going to be
974 check_and_add_compiler_option(-wd4710)
975 check_and_add_compiler_option(-wd4711)
977 # We do *not* care whether we're adding padding bytes after
980 check_and_add_compiler_option(-wd4820)
982 # We do *not* care about every single place the compiler would
983 # have inserted Spectre mitigation if only we had told it to
984 # do so with /Qspectre. I guess the theory is that it's seeing
985 # bounds checks that would prevent out-of-bounds loads and that
986 # those out-of-bounds loads could be done speculatively and that
987 # the Spectre attack could detect the value of the out-of-bounds
988 # data *if* it's within our address space, but unless I'm
989 # missing something I don't see that as being any form of
992 # XXX - add /Qspectre if that is really worth doing.
994 check_and_add_compiler_option(-wd5045)
996 # We do *not* care whether a structure had padding added at
997 # the end because of __declspec(align) - *we* don't use
998 # __declspec(align), because the only structures whose layout
999 # we precisely specify are those that get overlaid on packet
1000 # data, and in those every element is an array of octets so
1001 # that we have full control over the size and alignment, and,
1002 # apparently, jmp_buf has such a declaration on x86, meaning
1003 # that everything that includes netdissect.h, i.e. almost every
1004 # file in tcpdump, gets a warning.
1006 check_and_add_compiler_option(-wd4324)
1009 # Other compilers, including MSVC with a Clang front end and
1010 # Microsoft's code generator. We currently treat them as if
1011 # they might support GCC-style -W options.
1013 check_and_add_compiler_option(-W)
1014 check_and_add_compiler_option(-Wall)
1015 check_and_add_compiler_option(-Wassign-enum)
1016 check_and_add_compiler_option(-Wcast-qual)
1017 check_and_add_compiler_option(-Wmissing-prototypes)
1018 check_and_add_compiler_option(-Wmissing-variable-declarations)
1019 check_and_add_compiler_option(-Wold-style-definition)
1020 check_and_add_compiler_option(-Wpedantic)
1021 check_and_add_compiler_option(-Wpointer-arith)
1022 check_and_add_compiler_option(-Wpointer-sign)
1023 check_and_add_compiler_option(-Wshadow)
1024 check_and_add_compiler_option(-Wsign-compare)
1025 check_and_add_compiler_option(-Wstrict-prototypes)
1026 check_and_add_compiler_option(-Wunreachable-code-return)
1027 check_and_add_compiler_option(-Wused-but-marked-unused)
1028 check_and_add_compiler_option(-Wwrite-strings)
1033 # Extra compiler options for the build matrix scripts to request -Werror or
1034 # its equivalent if required. The CMake variable name cannot be CFLAGS
1035 # because that is already used for a different purpose in CMake. Example
1036 # usage: cmake -DEXTRA_CFLAGS='-Wall -Wextra -Werror' ...
1038 if(NOT "${EXTRA_CFLAGS}" STREQUAL "")
1039 foreach(_extra_cflag ${EXTRA_CFLAGS})
1040 check_and_add_compiler_option("${_extra_cflag}")
1041 endforeach(_extra_cflag)
1042 message(STATUS "Added extra compile options (${EXTRA_CFLAGS})")
1045 ######################################
1047 ######################################
1051 # We allow the SMB dissector to be omitted.
1053 set(LOCALSRC ${LOCALSRC}
1058 set(NETDISSECT_SOURCE_LIST_C
1174 print-openflow-1.0.c
1175 print-openflow-1.3.c
1245 # Replace missing functions
1247 foreach(FUNC strlcat strlcpy strsep getservent getopt_long)
1248 string(TOUPPER ${FUNC} FUNC_UPPERCASE)
1249 set(HAVE_FUNC_UPPERCASE HAVE_${FUNC_UPPERCASE})
1250 if(NOT ${HAVE_FUNC_UPPERCASE})
1251 set(NETDISSECT_SOURCE_LIST_C ${NETDISSECT_SOURCE_LIST_C} missing/${FUNC}.c)
1255 add_library(netdissect STATIC
1256 ${NETDISSECT_SOURCE_LIST_C}
1258 if(NOT C_ADDITIONAL_FLAGS STREQUAL "")
1259 set_target_properties(netdissect PROPERTIES COMPILE_FLAGS ${C_ADDITIONAL_FLAGS})
1262 set(TCPDUMP_SOURCE_LIST_C fptype.c tcpdump.c)
1264 if(NOT HAVE_BPF_DUMP)
1265 set(TCPDUMP_SOURCE_LIST_C ${TCPDUMP_SOURCE_LIST_C} bpf_dump.c)
1266 endif(NOT HAVE_BPF_DUMP)
1267 if(NOT HAVE_PCAP_DUMP_FTELL)
1268 set(TCPDUMP_SOURCE_LIST_C ${TCPDUMP_SOURCE_LIST_C} missing/pcap_dump_ftell.c)
1269 endif(NOT HAVE_PCAP_DUMP_FTELL)
1271 if(NOT HAVE_PCAP_LIST_DATALINKS)
1272 set(TCPDUMP_SOURCE_LIST_C ${TCPDUMP_SOURCE_LIST_C} missing/datalinks.c)
1273 endif(NOT HAVE_PCAP_LIST_DATALINKS)
1275 if((NOT HAVE_PCAP_DATALINK_NAME_TO_VAL) OR (NOT HAVE_PCAP_DATALINK_VAL_TO_DESCRIPTION))
1276 set(TCPDUMP_SOURCE_LIST_C ${TCPDUMP_SOURCE_LIST_C} missing/dlnames.c)
1277 endif((NOT HAVE_PCAP_DATALINK_NAME_TO_VAL) OR (NOT HAVE_PCAP_DATALINK_VAL_TO_DESCRIPTION))
1279 set(PROJECT_SOURCE_LIST_C ${NETDISSECT_SOURCE_LIST_C} ${TCPDUMP_SOURCE_LIST_C})
1281 file(GLOB PROJECT_SOURCE_LIST_H
1286 # Assume, by default, no support for shared libraries and V7/BSD
1287 # convention for man pages (devices in section 4, file formats in
1288 # section 5, miscellaneous info in section 7, administrative commands
1289 # and daemons in section 8). Individual cases can override this.
1290 # Individual cases can override this.
1292 set(MAN_FILE_FORMATS 5)
1293 set(MAN_MISC_INFO 7)
1294 if(CMAKE_SYSTEM_NAME STREQUAL "AIX")
1295 # Workaround to enable certain features
1297 elseif(CMAKE_SYSTEM_NAME STREQUAL "HP-UX")
1299 # Use System V conventions for man pages.
1301 set(MAN_FILE_FORMATS 4)
1302 set(MAN_MISC_INFO 5)
1303 elseif(CMAKE_SYSTEM_NAME STREQUAL "IRIX" OR CMAKE_SYSTEM_NAME STREQUAL "IRIX64")
1305 # Use IRIX conventions for man pages; they're the same as the
1306 # System V conventions, except that they use section 8 for
1307 # administrative commands and daemons.
1309 set(MAN_FILE_FORMATS 4)
1310 set(MAN_MISC_INFO 5)
1311 elseif(CMAKE_SYSTEM_NAME STREQUAL "OSF1")
1313 # DEC OSF/1, a/k/a Digital UNIX, a/k/a Tru64 UNIX.
1314 # Use Tru64 UNIX conventions for man pages; they're the same as the
1315 # System V conventions except that they use section 8 for
1316 # administrative commands and daemons.
1318 set(MAN_FILE_FORMATS 4)
1319 set(MAN_MISC_INFO 5)
1320 elseif(CMAKE_SYSTEM_NAME STREQUAL "SunOS" AND CMAKE_SYSTEM_VERSION MATCHES "5[.][0-9.]*")
1324 if(CMAKE_SYSTEM_VERSION STREQUAL "5.12")
1327 # Use System V conventions for man pages.
1329 set(MAN_FILE_FORMATS 4)
1330 set(MAN_MISC_INFO 5)
1334 source_group("Source Files" FILES ${PROJECT_SOURCE_LIST_C})
1335 source_group("Header Files" FILES ${PROJECT_SOURCE_LIST_H})
1337 ######################################
1339 ######################################
1341 add_executable(tcpdump ${TCPDUMP_SOURCE_LIST_C})
1342 if(NOT C_ADDITIONAL_FLAGS STREQUAL "")
1343 set_target_properties(tcpdump PROPERTIES COMPILE_FLAGS ${C_ADDITIONAL_FLAGS})
1345 target_link_libraries(tcpdump netdissect ${TCPDUMP_LINK_LIBRARIES})
1347 ######################################
1348 # Write out the config.h file
1349 ######################################
1351 configure_file(${CMAKE_CURRENT_SOURCE_DIR}/cmakeconfig.h.in ${CMAKE_CURRENT_BINARY_DIR}/config.h)
1353 ######################################
1354 # Install tcpdump and man pages
1355 ######################################
1358 # "Define GNU standard installation directories", which actually
1359 # are also defined, to some degree, by autotools, and at least
1360 # some of which are general UN*X conventions.
1362 include(GNUInstallDirs)
1364 set(MAN1_EXPAND tcpdump.1.in)
1367 # XXX TODO where to install on Windows?
1369 install(TARGETS tcpdump DESTINATION bin)
1372 # On UN*X, and on Windows when not using MSVC, process man pages and
1373 # arrange that they be installed.
1378 # For each section of the manual for which we have man pages
1379 # that require macro expansion, do the expansion.
1382 foreach(TEMPLATE_MANPAGE ${MAN1_EXPAND})
1383 string(REPLACE ".in" "" MANPAGE ${TEMPLATE_MANPAGE})
1384 configure_file(${CMAKE_SOURCE_DIR}/${TEMPLATE_MANPAGE} ${CMAKE_CURRENT_BINARY_DIR}/${MANPAGE} @ONLY)
1385 set(MAN1 ${MAN1} ${CMAKE_CURRENT_BINARY_DIR}/${MANPAGE})
1386 endforeach(TEMPLATE_MANPAGE)
1387 install(FILES ${MAN1} DESTINATION ${CMAKE_INSTALL_MANDIR}/man1)
1392 "${CMAKE_CURRENT_SOURCE_DIR}/cmake_uninstall.cmake.in"
1393 "${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake"
1396 add_custom_target(uninstall
1397 COMMAND ${CMAKE_COMMAND} -P ${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake)
1401 # We try to find the Perl interpreter and, if we do, we have the check
1402 # rule run tests/TESTrun with it, because just trying to run the TESTrun
1403 # script as a command won't work on Windows.
1405 find_program(PERL perl)
1407 message(STATUS "Found perl at ${PERL}")
1408 add_custom_target(check
1409 COMMAND ${PERL} ${CMAKE_SOURCE_DIR}/tests/TESTrun)
1411 message(STATUS "Didn't find perl")