From ef0efd72b51a44d30272dccffdc365165d385291 Mon Sep 17 00:00:00 2001 From: Maxim Biro Date: Wed, 17 Jul 2013 18:06:05 -0400 Subject: Improved build system --- testing/cmake/DHT_test.cmake | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 testing/cmake/DHT_test.cmake (limited to 'testing/cmake/DHT_test.cmake') diff --git a/testing/cmake/DHT_test.cmake b/testing/cmake/DHT_test.cmake new file mode 100644 index 00000000..e5c18c03 --- /dev/null +++ b/testing/cmake/DHT_test.cmake @@ -0,0 +1,10 @@ +cmake_minimum_required(VERSION 2.6.0) +project(DHT_test C) + +set(exe_name DHT_test) + +add_executable(${exe_name} + DHT_test.c) + +linkCoreLibraries(${exe_name}) +addCompilerFlags() -- cgit v1.2.3 From 6939a48226ec9cf2ab5d0a46e583831c195f2b7e Mon Sep 17 00:00:00 2001 From: Maxim Biro Date: Wed, 17 Jul 2013 18:28:53 -0400 Subject: Apply compiler flags only once --- CMakeLists.txt | 17 +++++++---------- other/cmake/DHT_bootstrap.cmake | 1 - testing/cmake/DHT_cryptosendfiletest.cmake | 3 +-- testing/cmake/DHT_sendfiletest.cmake | 1 - testing/cmake/DHT_test.cmake | 1 - testing/cmake/Lossless_UDP_testclient.cmake | 1 - testing/cmake/Lossless_UDP_testserver.cmake | 1 - testing/cmake/Messenger_test.cmake | 1 - testing/cmake/nTox.cmake | 1 - 9 files changed, 8 insertions(+), 19 deletions(-) (limited to 'testing/cmake/DHT_test.cmake') diff --git a/CMakeLists.txt b/CMakeLists.txt index db417a2f..c760beb5 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,5 +1,12 @@ cmake_minimum_required(VERSION 2.6.0) +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 ====") + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Werror") + endif() +endif() + if(WIN32) include_directories(${CMAKE_HOME_DIRECTORY}/sodium/include/) endif() @@ -24,15 +31,5 @@ macro(linkCoreLibraries exe_name) endif() endmacro() - -macro(addCompilerFlags) - 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 ====") - set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Werror") - endif() - endif() -endmacro() - ADD_SUBDIRECTORY(testing) ADD_SUBDIRECTORY(other) \ No newline at end of file diff --git a/other/cmake/DHT_bootstrap.cmake b/other/cmake/DHT_bootstrap.cmake index f978baa4..c3c313ae 100644 --- a/other/cmake/DHT_bootstrap.cmake +++ b/other/cmake/DHT_bootstrap.cmake @@ -7,4 +7,3 @@ add_executable(${exe_name} DHT_bootstrap.c) linkCoreLibraries(${exe_name}) -addCompilerFlags() diff --git a/testing/cmake/DHT_cryptosendfiletest.cmake b/testing/cmake/DHT_cryptosendfiletest.cmake index 9396d91a..8d6079f8 100644 --- a/testing/cmake/DHT_cryptosendfiletest.cmake +++ b/testing/cmake/DHT_cryptosendfiletest.cmake @@ -6,5 +6,4 @@ set(exe_name DHT_cryptosendfiletest) add_executable(${exe_name} DHT_cryptosendfiletest.c) -linkCoreLibraries(${exe_name}) -addCompilerFlags() +linkCoreLibraries(${exe_name}) \ No newline at end of file diff --git a/testing/cmake/DHT_sendfiletest.cmake b/testing/cmake/DHT_sendfiletest.cmake index c7595224..93737914 100644 --- a/testing/cmake/DHT_sendfiletest.cmake +++ b/testing/cmake/DHT_sendfiletest.cmake @@ -7,4 +7,3 @@ add_executable(${exe_name} DHT_sendfiletest.c) linkCoreLibraries(${exe_name}) -addCompilerFlags() diff --git a/testing/cmake/DHT_test.cmake b/testing/cmake/DHT_test.cmake index e5c18c03..bcde4370 100644 --- a/testing/cmake/DHT_test.cmake +++ b/testing/cmake/DHT_test.cmake @@ -7,4 +7,3 @@ add_executable(${exe_name} DHT_test.c) linkCoreLibraries(${exe_name}) -addCompilerFlags() diff --git a/testing/cmake/Lossless_UDP_testclient.cmake b/testing/cmake/Lossless_UDP_testclient.cmake index 375bb733..e894d228 100644 --- a/testing/cmake/Lossless_UDP_testclient.cmake +++ b/testing/cmake/Lossless_UDP_testclient.cmake @@ -7,4 +7,3 @@ add_executable(${exe_name} Lossless_UDP_testclient.c) linkCoreLibraries(${exe_name}) -addCompilerFlags() diff --git a/testing/cmake/Lossless_UDP_testserver.cmake b/testing/cmake/Lossless_UDP_testserver.cmake index fe16e937..04306c1a 100644 --- a/testing/cmake/Lossless_UDP_testserver.cmake +++ b/testing/cmake/Lossless_UDP_testserver.cmake @@ -7,4 +7,3 @@ add_executable(${exe_name} Lossless_UDP_testserver.c) linkCoreLibraries(${exe_name}) -addCompilerFlags() diff --git a/testing/cmake/Messenger_test.cmake b/testing/cmake/Messenger_test.cmake index 2848818b..a85e043d 100644 --- a/testing/cmake/Messenger_test.cmake +++ b/testing/cmake/Messenger_test.cmake @@ -7,4 +7,3 @@ add_executable(${exe_name} Messenger_test.c) linkCoreLibraries(${exe_name}) -addCompilerFlags() diff --git a/testing/cmake/nTox.cmake b/testing/cmake/nTox.cmake index 814b1427..1656bc80 100644 --- a/testing/cmake/nTox.cmake +++ b/testing/cmake/nTox.cmake @@ -9,4 +9,3 @@ add_executable(${exe_name} target_link_libraries(${exe_name} ncurses) linkCoreLibraries(${exe_name}) -addCompilerFlags() -- cgit v1.2.3