2013-06-25 08:55:30 +08:00
|
|
|
cmake_minimum_required(VERSION 2.6.0)
|
2013-07-13 06:31:57 +08:00
|
|
|
|
2013-07-18 06:28:53 +08:00
|
|
|
if(NOT WIN32)
|
|
|
|
if(("${CMAKE_C_COMPILER_ID}" STREQUAL "GNU") OR ("${CMAKE_C_COMPILER_ID}" STREQUAL "Clang"))
|
|
|
|
message(STATUS "==== ${CMAKE_C_COMPILER_ID} detected - Adding compiler flags ====")
|
|
|
|
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Werror")
|
|
|
|
endif()
|
|
|
|
endif()
|
|
|
|
|
2013-07-18 06:06:05 +08:00
|
|
|
if(WIN32)
|
|
|
|
include_directories(${CMAKE_HOME_DIRECTORY}/sodium/include/)
|
|
|
|
endif()
|
2013-07-13 06:31:57 +08:00
|
|
|
|
2013-06-25 08:55:30 +08:00
|
|
|
set(core_sources
|
2013-07-13 04:27:19 +08:00
|
|
|
core/DHT.c
|
|
|
|
core/network.c
|
|
|
|
core/Lossless_UDP.c
|
|
|
|
core/net_crypto.c
|
|
|
|
core/Messenger.c)
|
|
|
|
|
2013-07-18 06:06:05 +08:00
|
|
|
add_library(core ${core_sources})
|
2013-06-25 08:55:30 +08:00
|
|
|
|
2013-07-18 06:06:05 +08:00
|
|
|
macro(linkCoreLibraries exe_name)
|
|
|
|
if(WIN32)
|
|
|
|
target_link_libraries(${exe_name} core
|
|
|
|
${CMAKE_SOURCE_DIR}/sodium/lib/libsodium.a
|
|
|
|
ws2_32)
|
|
|
|
else()
|
|
|
|
target_link_libraries(${exe_name} core
|
|
|
|
sodium)
|
|
|
|
endif()
|
|
|
|
endmacro()
|
2013-06-26 13:03:35 +08:00
|
|
|
|
2013-07-18 06:41:58 +08:00
|
|
|
cmake_policy(SET CMP0011 NEW)
|
|
|
|
|
2013-07-18 06:06:05 +08:00
|
|
|
ADD_SUBDIRECTORY(testing)
|
|
|
|
ADD_SUBDIRECTORY(other)
|