2 # Copyright (C) 2017 Ali Abdulkadir <autostart.ini@gmail.com>.
4 # Permission is hereby granted, free of charge, to any person
5 # obtaining a copy of this software and associated documentation files
6 # (the "Software"), to deal in the Software without restriction,
7 # including without limitation the rights to use, copy, modify, merge,
8 # publish, distribute, sub-license, and/or sell copies of the Software,
9 # and to permit persons to whom the Software is furnished to do so,
10 # subject to the following conditions:
12 # The above copyright notice and this permission notice shall be
13 # included in all copies or substantial portions of the Software.
15 # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
16 # EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
17 # MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
18 # NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
19 # BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
20 # ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
21 # CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
27 # Find the Packet library and include files.
29 # This module defines the following variables:
31 # Packet_INCLUDE_DIR - absolute path to the directory containing Packet32.h.
33 # Packet_LIBRARY - relative or absolute path to the Packet library to
34 # link with. An absolute path is will be used if the
35 # Packet library is not located in the compiler's
36 # default search path.
38 # Packet_FOUND - TRUE if the Packet library *and* header are found.
40 # Hints and Backward Compatibility
41 # ================================
43 # To tell this module where to look, a user may set the environment variable
44 # Packet_ROOT to point cmake to the *root* of a directory with include and
45 # lib subdirectories for packet.dll (e.g WpdPack or npcap-sdk).
46 # Alternatively, Packet_ROOT may also be set from cmake command line or GUI
47 # (e.g cmake -DPacket_ROOT=C:\path\to\packet [...])
50 if(CMAKE_GENERATOR_PLATFORM STREQUAL "Win32")
52 # 32-bit x86; no need to look in subdirectories of the SDK's
53 # Lib directory for the libraries, as the libraries are in
58 # Platform other than 32-bit x86.
60 # For the WinPcap and Npcap SDKs, the Lib subdirectory of the top-level
61 # directory contains 32-bit x86 libraries; the libraries for other
62 # platforms are in subdirectories of the Lib directory whose names
63 # are the names of the supported platforms.
65 # The only way to *FORCE* CMake to look in the appropriate
66 # subdirectory of Lib for libraries without searching in the
67 # Lib directory first appears to be to set
68 # CMAKE_LIBRARY_ARCHITECTURE to the name of the subdirectory.
70 set(CMAKE_LIBRARY_ARCHITECTURE "${CMAKE_GENERATOR_PLATFORM}")
74 find_path(Packet_INCLUDE_DIR Packet32.h
75 PATH_SUFFIXES include Include
79 find_library(Packet_LIBRARY
83 # Set Packet_FOUND to TRUE if Packet_INCLUDE_DIR and Packet_LIBRARY are TRUE.
84 include(FindPackageHandleStandardArgs)
85 find_package_handle_standard_args(Packet
91 mark_as_advanced(Packet_INCLUDE_DIR Packet_LIBRARY)
93 set(Packet_INCLUDE_DIRS ${Packet_INCLUDE_DIR})
94 set(Packet_LIBRARIES ${Packet_LIBRARY})