Commit a1dfb3ce authored by Atkins, Charles Vernon's avatar Atkins, Charles Vernon
Browse files

Merge branch 'upstream-enet' into fix-export-configs

* upstream-enet:
  enet 2018-12-18 (caaabf74)
parents 4006968c 2c3b4cff
Loading
Loading
Loading
Loading
+12 −28
Original line number Diff line number Diff line
cmake_minimum_required(VERSION 3.6)
cmake_minimum_required(VERSION 3.3)

project(ENET VERSION 1.3.13 LANGUAGES C)
project(ENET VERSION 1.3.14 LANGUAGES C)

# Some boilerplate to setup nice output directories
set(CMAKE_INSTALL_BINDIR bin CACHE STRING "Installation runtime subdirectory")
@@ -44,24 +44,6 @@ cmake_dependent_option(BUILD_SHARED_LIBS
)
mark_as_advanced(BUILD_SHARED_LIBS)

# Setup PIC defaults.  If explicitly specified somehow, then default 
# to that.  Otherwise base the default on whether or not shared libs are even
# supported.
if(DEFINED ENET_ENABLE_PIC)
  set(ENET_ENABLE_PIC_DEFAULT ${ENET_ENABLE_PIC})
elseif(DEFINED CMAKE_POSITION_INDEPENDENT_CODE)
  set(ENET_ENABLE_PIC_DEFAULT ${CMAKE_POSITION_INDEPENDENT_CODE})
else()
  set(ENET_ENABLE_PIC_DEFAULT ${SHARED_LIBS_SUPPORTED})
endif()
cmake_dependent_option(ENET_ENABLE_PIC
  "Build with Position Independent Code" ${ENET_ENABLE_PIC_DEFAULT}
  "SHARED_LIBS_SUPPORTED" OFF
)
mark_as_advanced(ENET_ENABLE_PIC)
set(CMAKE_POSITION_INDEPENDENT_CODE ${ENET_ENABLE_PIC})
mark_as_advanced(CMAKE_POSITION_INDEPENDENT_CODE)

include(CheckFunctionExists)
check_function_exists(getaddrinfo HAS_GETADDRINFO)
check_function_exists(getnameinfo HAS_GETNAMEINFO)
@@ -154,12 +136,14 @@ install(TARGETS enet
# Setup packaging and configs

# Add all targets to the build-tree export set
export(TARGETS enet NAMESPACE enet::
  FILE "${PROJECT_BINARY_DIR}/enet-targets.cmake")
include(CMakePackageConfigHelpers)
write_basic_package_version_file(
  "${PROJECT_BINARY_DIR}/enet-config-version.cmake"
  COMPATIBILITY SameMajorVersion)
configure_file(enet-config.cmake.in
  "${PROJECT_BINARY_DIR}/enet-config.cmake" @ONLY)
configure_file(enet-config-version.cmake.in
  "${PROJECT_BINARY_DIR}/enet-config-version.cmake" @ONLY)
export(TARGETS enet NAMESPACE enet::
  FILE "${PROJECT_BINARY_DIR}/enet-targets.cmake")

# Install the enet-config.cmake and enet-config-version.cmake
install(FILES
+0 −15
Original line number Diff line number Diff line
set(PACKAGE_VERSION_MAJOR @ENET_VERSION_MAJOR@)
set(PACKAGE_VERSION_MINOR @ENET_VERSION_MINOR@)
set(PACKAGE_VERSION_PATCH @ENET_VERSION_PATCH@)
set(PACKAGE_VERSION @ENET_VERSION@)

# Check whether the requested PACKAGE_FIND_VERSION is compatible
if(PACKAGE_VERSION VERSION_LESS PACKAGE_FIND_VERSION OR
   PACKAGE_VERSION_MAJOR GREATER PACKAGE_FIND_VERSION_MAJOR)
  set(PACKAGE_VERSION_COMPATIBLE FALSE)
else()
  set(PACKAGE_VERSION_COMPATIBLE TRUE)
  if(PACKAGE_VERSION VERSION_EQUAL PACKAGE_FIND_VERSION)
    set(PACKAGE_VERSION_EXACT TRUE)
  endif()
endif()
+0 −12
Original line number Diff line number Diff line
# - Config file for the ENET package
#
# It defines the following variables
#   ENET_INCLUDE_DIRS - include directories for Dill
#   ENET_LIBRARIES    - libraries to link against
#
# And the folloing imported targets:
#   enet::enet
#
 
include("${CMAKE_CURRENT_LIST_DIR}/enet-config-version.cmake")

include(FindPackageHandleStandardArgs)
set(${CMAKE_FIND_PACKAGE_NAME}_CONFIG "${CMAKE_CURRENT_LIST_FILE}")
find_package_handle_standard_args(${CMAKE_FIND_PACKAGE_NAME} CONFIG_MODE)