summaryrefslogtreecommitdiff
path: root/CMakeLists.txt
diff options
context:
space:
mode:
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r--CMakeLists.txt50
1 files changed, 25 insertions, 25 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index ec474ffb..505983f2 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1,7 +1,15 @@
1cmake_minimum_required(VERSION 2.6.0) 1cmake_minimum_required(VERSION 2.6.0)
2project(TOX C)
3 2
4set(exe_name toxMessengerTest) 3if(NOT WIN32)
4 if(("${CMAKE_C_COMPILER_ID}" STREQUAL "GNU") OR ("${CMAKE_C_COMPILER_ID}" STREQUAL "Clang"))
5 message(STATUS "==== ${CMAKE_C_COMPILER_ID} detected - Adding compiler flags ====")
6 set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Werror")
7 endif()
8endif()
9
10if(WIN32)
11 include_directories(${CMAKE_HOME_DIRECTORY}/sodium/include/)
12endif()
5 13
6set(core_sources 14set(core_sources
7 core/DHT.c 15 core/DHT.c
@@ -9,29 +17,21 @@ set(core_sources
9 core/Lossless_UDP.c 17 core/Lossless_UDP.c
10 core/net_crypto.c 18 core/net_crypto.c
11 core/Messenger.c) 19 core/Messenger.c)
12if(WIN32)
13 set(test_sources
14 testing/Messenger_test.c)
15else()
16 set(test_sources
17 testing/nTox.c)
18 #testing/Messenger_test.c)
19endif()
20 20
21add_executable(${exe_name} 21add_library(core ${core_sources})
22 ${core_sources}
23 ${test_sources})
24 22
25if(WIN32) 23macro(linkCoreLibraries exe_name)
26 include_directories(${TOX_SOURCE_DIR}/sodium/include/) 24 if(WIN32)
27 target_link_libraries(${exe_name} ws2_32 25 target_link_libraries(${exe_name} core
28 ${CMAKE_SOURCE_DIR}/sodium/lib/libsodium.a) 26 ${CMAKE_SOURCE_DIR}/sodium/lib/libsodium.a
29else() 27 ws2_32)
30 target_link_libraries(${exe_name} sodium) 28 else()
31 target_link_libraries(${exe_name} ncurses) 29 target_link_libraries(${exe_name} core
32endif() 30 sodium)
31 endif()
32endmacro()
33 33
34if(CMAKE_COMPILER_IS_GNUCC) 34cmake_policy(SET CMP0011 NEW)
35 message(STATUS "==== GCC detected - Adding compiler flags ====") 35
36 set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Werror") 36ADD_SUBDIRECTORY(testing)
37endif() 37ADD_SUBDIRECTORY(other) \ No newline at end of file