File tree Expand file tree Collapse file tree 2 files changed +35
-7
lines changed Expand file tree Collapse file tree 2 files changed +35
-7
lines changed Original file line number Diff line number Diff line change
1
+ # - Find ENet
2
+ # Find the native ENet includes and libraries
3
+ #
4
+ # ENET_INCLUDE_DIR - where to find ENet headers.
5
+ # ENET_LIBRARIES - List of libraries when using libenet.
6
+ # ENET_FOUND - True if libenet found.
7
+
8
+ if (ENET_INCLUDE_DIR)
9
+ # Already in cache, be silent
10
+ set (ENET_FIND_QUIETLY TRUE )
11
+ endif (ENET_INCLUDE_DIR)
12
+
13
+ find_path (ENET_INCLUDE_DIR enet/enet.h)
14
+
15
+ find_library (ENET_LIBRARY NAMES enet enet_static libenet libenet_static)
16
+
17
+ # Handle the QUIETLY and REQUIRED arguments and set ENET_FOUND to TRUE if
18
+ # all listed variables are TRUE.
19
+ include (FindPackageHandleStandardArgs)
20
+ find_package_handle_standard_args(ENET DEFAULT_MSG
21
+ ENET_INCLUDE_DIR ENET_LIBRARY)
22
+
23
+ if (ENET_FOUND)
24
+ set (ENET_LIBRARIES ${ENET_LIBRARY} )
25
+ else (ENET_FOUND)
26
+ set (ENET_LIBRARIES)
27
+ endif (ENET_FOUND)
28
+
29
+ mark_as_advanced (ENET_INCLUDE_DIR ENET_LIBRARY)
Original file line number Diff line number Diff line change @@ -245,13 +245,12 @@ if(WANT_CURL_EXAMPLE)
245
245
endif (CURL_FOUND)
246
246
endif (WANT_CURL_EXAMPLE)
247
247
248
- # The enet example won't compile if the enet library isn't available.
249
- # This example isn't important so it's disabled by default to prevent problems.
250
- option (WANT_ENET_EXAMPLE "Build ex_enet example" off )
251
- if (WANT_ENET_EXAMPLE)
252
- example(ex_enet_client -lenet ${PRIM} )
253
- example(ex_enet_server -lenet)
254
- endif (WANT_ENET_EXAMPLE)
248
+ # Only build the enet examples if libenet is installed
249
+ find_package (ENet)
250
+ if (ENET_FOUND)
251
+ example(ex_enet_client ${ENET_LIBRARIES} ${PRIM} )
252
+ example(ex_enet_server ${ENET_LIBRARIES} )
253
+ endif (ENET_FOUND)
255
254
256
255
# example(ex_ogre3d ex_ogre3d.cpp)
257
256
# include_directories(/usr/include/OGRE)
You can’t perform that action at this time.
0 commit comments