diff options
author | irungentoo <irungentoo@gmail.com> | 2013-07-17 15:46:59 -0700 |
---|---|---|
committer | irungentoo <irungentoo@gmail.com> | 2013-07-17 15:46:59 -0700 |
commit | e02620c7bed8764421b9b4c258e594369615da39 (patch) | |
tree | f37ab9110d076e69b2c05c2b2a8a1659fb951b24 /CMakeLists.txt | |
parent | 817ad50d9640b8ccce3636a00f732245ff09d38c (diff) | |
parent | ec38df6f91a51f7ef9b91384b2dc4817047421cd (diff) |
Merge pull request #45 from nurupo/master
Improved build system
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r-- | CMakeLists.txt | 50 |
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 @@ | |||
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(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() | ||
8 | endif() | ||
9 | |||
10 | if(WIN32) | ||
11 | include_directories(${CMAKE_HOME_DIRECTORY}/sodium/include/) | ||
12 | endif() | ||
5 | 13 | ||
6 | set(core_sources | 14 | set(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) |
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 | 20 | ||
21 | add_executable(${exe_name} | 21 | add_library(core ${core_sources}) |
22 | ${core_sources} | ||
23 | ${test_sources}) | ||
24 | 22 | ||
25 | if(WIN32) | 23 | macro(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 |
29 | else() | 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 |
32 | endif() | 30 | sodium) |
31 | endif() | ||
32 | endmacro() | ||
33 | 33 | ||
34 | if(CMAKE_COMPILER_IS_GNUCC) | 34 | cmake_policy(SET CMP0011 NEW) |
35 | message(STATUS "==== GCC detected - Adding compiler flags ====") | 35 | |
36 | set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Werror") | 36 | ADD_SUBDIRECTORY(testing) |
37 | endif() | 37 | ADD_SUBDIRECTORY(other) \ No newline at end of file |