From 533f136d0e79d3a6f50080baaa434c5ee546c2ee Mon Sep 17 00:00:00 2001 From: Maxim Biro Date: Sun, 21 Jul 2013 20:41:08 -0400 Subject: [PATCH] Made a cmake project for Core --- CMakeLists.txt | 21 ++++++--------------- core/CMakeLists.txt | 15 +++++++++++++++ 2 files changed, 21 insertions(+), 15 deletions(-) create mode 100644 core/CMakeLists.txt diff --git a/CMakeLists.txt b/CMakeLists.txt index 505983f2..187c0794 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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) \ No newline at end of file +add_subdirectory(core) +add_subdirectory(testing) +add_subdirectory(other) \ No newline at end of file diff --git a/core/CMakeLists.txt b/core/CMakeLists.txt new file mode 100644 index 00000000..51f30e17 --- /dev/null +++ b/core/CMakeLists.txt @@ -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})