diff --git a/cmake/Modules/FindENet.cmake b/cmake/Modules/FindENet.cmake new file mode 100644 index 000000000..3228aadb6 --- /dev/null +++ b/cmake/Modules/FindENet.cmake @@ -0,0 +1,34 @@ +# Find ENet +# Once done, this will define +# +# ENET_FOUND - system has SDL2 +# ENET_INCLUDE_DIRS - SDL2 include directories +# ENET_LIBRARIES - link libraries + +include(LibFindMacros) + +libfind_pkg_check_modules(ENET_PKGCONF ENET) + +# includes +find_path(ENET_INCLUDE_DIR + NAMES enet.h + PATHS + ${ENET_PKGCONF_INCLUDE_DIRS} + "/usr/include/enet" + "/usr/local/include/enet" +) + +# library +find_library(ENET_LIBRARY + NAMES libenet + PATHS + ${ENET_PKGCONF_LIBRARY_DIRS} + "/usr/lib" + "/usr/local/lib" +) + + +# set include dir variables +set(ENET_PROCESS_INCLUDES ENET_INCLUDE_DIR) +set(ENET_PROCESS_LIBS ENET_LIBRARY) +libfind_process(ENET) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 716cf6cf8..1eee89b96 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -404,6 +404,8 @@ else() add_definitions(-DNOASM -DNONX86) endif() +find_package(ENet) + # Targets # Compatibility flag with later versions of GCC diff --git a/src/sdl/CMakeLists.txt b/src/sdl/CMakeLists.txt index b3fa5390c..abbd5f284 100644 --- a/src/sdl/CMakeLists.txt +++ b/src/sdl/CMakeLists.txt @@ -125,6 +125,7 @@ if(${SDL2_FOUND}) ${PNG_LIBRARIES} ${ZLIB_LIBRARIES} ${OPENGL_LIBRARIES} + ${ENET_LIBRARIES} ) set_target_properties(SRB2SDL2 PROPERTIES OUTPUT_NAME "Sonic Robo Blast 2") else() @@ -134,6 +135,7 @@ if(${SDL2_FOUND}) ${PNG_LIBRARIES} ${ZLIB_LIBRARIES} ${OPENGL_LIBRARIES} + ${ENET_LIBRARIES} ) if(${CMAKE_SYSTEM} MATCHES Linux) @@ -201,6 +203,7 @@ if(${SDL2_FOUND}) ${PNG_INCLUDE_DIRS} ${ZLIB_INCLUDE_DIRS} ${OPENGL_INCLUDE_DIRS} + ${ENET_INCLUDE_DIRS} ) if(${SRB2_HAVE_MIXER})