diff options
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r-- | CMakeLists.txt | 51 |
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 @@ | |||
1 | cmake_minimum_required(VERSION 2.6.0) | 1 | cmake_minimum_required(VERSION 2.6.0) |
2 | project(TOX C) | ||
3 | 2 | ||
4 | set(exe_name toxMessengerTest) | 3 | if(WIN32) |
4 | include_directories(${CMAKE_HOME_DIRECTORY}/sodium/include/) | ||
5 | endif() | ||
5 | 6 | ||
6 | set(core_sources | 7 | set(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) |
12 | if(WIN32) | ||
13 | set(test_sources | ||
14 | testing/Messenger_test.c) | ||
15 | else() | ||
16 | set(test_sources | ||
17 | testing/nTox.c) | ||
18 | #testing/Messenger_test.c) | ||
19 | endif() | ||
20 | 13 | ||
21 | add_executable(${exe_name} | 14 | add_library(core ${core_sources}) |
22 | ${core_sources} | ||
23 | ${test_sources}) | ||
24 | 15 | ||
25 | if(WIN32) | 16 | macro(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 |
29 | else() | 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 |
32 | endif() | 23 | sodium) |
24 | endif() | ||
25 | endmacro() | ||
33 | 26 | ||
34 | if(CMAKE_COMPILER_IS_GNUCC) | 27 | |
35 | message(STATUS "==== GCC detected - Adding compiler flags ====") | 28 | macro(addCompilerFlags) |
36 | set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Werror") | 29 | if(NOT WIN32) |
37 | endif() | 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() | ||
35 | endmacro() | ||
36 | |||
37 | ADD_SUBDIRECTORY(testing) | ||
38 | ADD_SUBDIRECTORY(other) \ No newline at end of file | ||