2018-02-14 01:16:58 +00:00
|
|
|
cmake_minimum_required(VERSION 2.6)
|
2018-04-15 19:37:27 +00:00
|
|
|
project(server)
|
2018-02-14 01:16:58 +00:00
|
|
|
|
2018-02-15 23:09:09 +00:00
|
|
|
file(GLOB_RECURSE server_src
|
|
|
|
"src/*.hpp"
|
|
|
|
"src/*.cpp"
|
2018-04-13 17:21:48 +00:00
|
|
|
"src/*.c"
|
|
|
|
"src/*.h"
|
2018-03-20 22:42:26 +00:00
|
|
|
)
|
2018-02-15 23:09:09 +00:00
|
|
|
|
2018-03-07 23:07:28 +00:00
|
|
|
if(CMAKE_COMPILER_IS_GNUCXX)
|
|
|
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -static")
|
|
|
|
endif()
|
|
|
|
|
2018-02-15 23:09:09 +00:00
|
|
|
add_executable(server ${server_src})
|
2018-02-14 01:16:58 +00:00
|
|
|
|
2018-04-15 19:37:27 +00:00
|
|
|
if(${CMAKE_SYSTEM_NAME} STREQUAL "Windows")
|
2018-03-07 23:07:28 +00:00
|
|
|
target_link_libraries(server wsock32 ws2_32)
|
2018-04-15 19:37:27 +00:00
|
|
|
elseif(${CMAKE_SYSTEM_NAME} STREQUAL "Linux")
|
|
|
|
target_link_libraries(server dl pthread nsl resolv)
|
2018-03-07 23:07:28 +00:00
|
|
|
else()
|
2018-04-15 19:37:27 +00:00
|
|
|
target_link_libraries(server dl pthread socket nsl resolv)
|
2018-03-07 23:07:28 +00:00
|
|
|
endif()
|
|
|
|
|
2018-04-10 13:06:25 +00:00
|
|
|
install(TARGETS server RUNTIME DESTINATION bin)
|
2018-03-21 04:29:24 +00:00
|
|
|
|