auriamg / stk-code

The code base of supertuxkart
Other
0 stars 0 forks source link

cmake support for system copy of enet #508

Open auriamg opened 10 years ago

auriamg commented 10 years ago

in Debian/Ubuntu, supertuxkart is built with a system copy of enet instead of the embedded copy (the patch against autotools that was used can be found here, although it's not forward-able upstream as is). Given that autotools support has been deprecated in stk, I'm looking at converting the Debian build scripts to use cmake instead of autotools.

Unfortunately I have practically zero knowledge of cmake, so I'm unable to offer up any patches right now, but would it be possible for supertuxkart to look for a system copy of enet and use it if found, and fall back to using the embedded copy otherwise?

Migrated-From: https://sourceforge.net/apps/trac/supertuxkart/t/ticket/640

auriamg commented 10 years ago

Author: vincent-c Here's my proposed addition (FindENet.cmake) to detect a system copy of enet:

# - Find ENet
# Find the ENet includes and libraries
#
# Following variables are provided:
# ENET_FOUND
#     True if ENet has been found
# ENET_INCLUDE_DIR
#     The include directories of ENet
# ENET_LIBRARIES
#     ENet library list

find_path(ENET_INCLUDE_DIR enet/enet.h /usr/include)
find_library(ENET_LIBRARY NAMES enet PATHS /usr/lib)

include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(ENet DEFAULT_MSG ENET_INCLUDE_DIR ENET_LIBRARY)

# Publish variables
set(ENET_INCLUDE_DIRS ${ENET_INCLUDE_DIR})
set(ENET_LIBRARIES ${ENET_LIBRARY})
mark_as_advanced(ENET_INCLUDE_DIR ENET_LIBRARY)

The copy of CMakeLists.txt in the root dir also has to be modified, but I'm not sure how to change it so that it falls back to building the embedded enet copy if enet isn't already installed on the user's system...