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