/
Findenet.cmake
52 lines (47 loc) · 1.16 KB
/
Findenet.cmake
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
# file Copyright.txt or https://cmake.org/licensing for details.
#.rst:
# Findenet
# -------
#
# Finds the libenet library
#
# This will define the following variables::
#
# enet_FOUND - True if the system has the enet library
#
# and also the following imported target:
#
# enet::enet
#
find_package(PkgConfig)
pkg_check_modules(PC_enet QUIET enet)
find_path(enet_INCLUDE_DIR
NAMES enet/enet.h
PATHS ${PC_enet_INCLUDE_DIRS}
PATH_SUFFIXES enet
)
find_library(enet_LIBRARY
NAMES enet
PATHS ${PC_enet_LIBRARY_DIRS}
)
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(enet
FOUND_VAR enet_FOUND
REQUIRED_VARS
enet_LIBRARY
enet_INCLUDE_DIR
)
if (enet_FOUND)
add_library(enet::enet STATIC IMPORTED)
set_target_properties(enet::enet PROPERTIES
IMPORTED_LOCATION ${enet_LIBRARY}
INTERFACE_INCLUDE_DIRECTORIES ${enet_INCLUDE_DIR}
)
target_include_directories(enet::enet INTERFACE ${enet_INCLUDE_DIR})
if (WIN32)
set_target_properties(enet::enet PROPERTIES
INTERFACE_LINK_LIBRARIES "ws2_32;winmm"
)
endif (WIN32)
endif (enet_FOUND)