speed-dreams-code/packaging/3rdParty-devel/patches/enet-1.3.13.CMakeLists.txt
beaglejoe 5c36651be4 Added eol = native
git-svn-id: https://svn.code.sf.net/p/speed-dreams/code/trunk@6083 30fe4595-0a0c-4342-8851-515496e4dcbd

Former-commit-id: 0ae9bc12524f9a61f273e9b6a8e4789a2f8d72c5
Former-commit-id: bfb8349d1d4fcc566876dab2a7cc8bdee3c7228e
2015-08-20 20:53:48 +00:00

92 lines
No EOL
2.4 KiB
Text

cmake_minimum_required(VERSION 2.8)
project(enet C CXX)
set(VERSION "1.3.13")
# From the enet 1.3.13 CMakeLists.txt
####################################################
# The "configure" step.
include(CheckFunctionExists)
include(CheckStructHasMember)
include(CheckTypeSize)
check_function_exists("fcntl" HAS_FCNTL)
check_function_exists("poll" HAS_POLL)
check_function_exists("gethostbyname_r" HAS_GETHOSTBYNAME_R)
check_function_exists("gethostbyaddr_r" HAS_GETHOSTBYADDR_R)
check_function_exists("inet_pton" HAS_INET_PTON)
check_function_exists("inet_ntop" HAS_INET_NTOP)
check_struct_has_member("struct msghdr" "msg_flags" "sys/types.h;sys/socket.h" HAS_MSGHDR_FLAGS)
set(CMAKE_EXTRA_INCLUDE_FILES "sys/types.h" "sys/socket.h")
check_type_size("socklen_t" HAS_SOCKLEN_T BUILTIN_TYPES_ONLY)
unset(CMAKE_EXTRA_INCLUDE_FILES)
if(HAS_FCNTL)
add_definitions(-DHAS_FCNTL=1)
endif()
if(HAS_POLL)
add_definitions(-DHAS_POLL=1)
endif()
if(HAS_GETHOSTBYNAME_R)
add_definitions(-DHAS_GETHOSTBYNAME_R=1)
endif()
if(HAS_GETHOSTBYADDR_R)
add_definitions(-DHAS_GETHOSTBYADDR_R=1)
endif()
if(HAS_INET_PTON)
add_definitions(-DHAS_INET_PTON=1)
endif()
if(HAS_INET_NTOP)
add_definitions(-DHAS_INET_NTOP=1)
endif()
if(HAS_MSGHDR_FLAGS)
add_definitions(-DHAS_MSGHDR_FLAGS=1)
endif()
if(HAS_SOCKLEN_T)
add_definitions(-DHAS_SOCKLEN_T=1)
endif()
####################################################
# end From the enet 1.3.13 CMakeLists.txt
include_directories(include)
set(enet_SOURCES callbacks.c
compress.c
host.c
list.c
packet.c
peer.c
protocol.c
unix.c
win32.c
)
set(enet_HEADERS include/enet/callbacks.h
include/enet/enet.h
include/enet/list.h
include/enet/protocol.h
include/enet/time.h
include/enet/types.h
include/enet/unix.h
include/enet/utility.h
include/enet/win32.h
)
add_library(enet STATIC ${enet_SOURCES} ${enet_HEADERS})
# TODO - this is NOT working Static lib??
if(WIN32)
target_link_libraries(enet ws2_32 winmm)
endif(WIN32)
install(FILES ${enet_HEADERS}
DESTINATION include/enet)
install(TARGETS enet
RUNTIME DESTINATION bin
LIBRARY DESTINATION lib
ARCHIVE DESTINATION lib)