Made a cmake project for Core

This commit is contained in:
Maxim Biro 2013-07-21 20:41:08 -04:00
parent d35ddc1618
commit 533f136d0e
2 changed files with 21 additions and 15 deletions

View File

@ -1,5 +1,6 @@
cmake_minimum_required(VERSION 2.6.0)
#MinGW prints more warnings for -Wall than gcc does, thus causing build to fail
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 ====")
@ -7,21 +8,10 @@ if(NOT WIN32)
endif()
endif()
if(WIN32)
include_directories(${CMAKE_HOME_DIRECTORY}/sodium/include/)
endif()
set(core_sources
core/DHT.c
core/network.c
core/Lossless_UDP.c
core/net_crypto.c
core/Messenger.c)
add_library(core ${core_sources})
macro(linkCoreLibraries exe_name)
add_dependencies(${exe_name} core)
if(WIN32)
include_directories(${CMAKE_HOME_DIRECTORY}/sodium/include/)
target_link_libraries(${exe_name} core
${CMAKE_SOURCE_DIR}/sodium/lib/libsodium.a
ws2_32)
@ -33,5 +23,6 @@ endmacro()
cmake_policy(SET CMP0011 NEW)
ADD_SUBDIRECTORY(testing)
ADD_SUBDIRECTORY(other)
add_subdirectory(core)
add_subdirectory(testing)
add_subdirectory(other)

15
core/CMakeLists.txt Normal file
View File

@ -0,0 +1,15 @@
cmake_minimum_required(VERSION 2.6.0)
project(core C)
if(WIN32)
include_directories(${CMAKE_HOME_DIRECTORY}/sodium/include/)
endif()
set(core_sources
DHT.c
network.c
Lossless_UDP.c
net_crypto.c
Messenger.c)
add_library(core ${core_sources})