Apply compiler flags only once

This commit is contained in:
Maxim Biro 2013-07-17 18:28:53 -04:00
parent e9f0059a15
commit 6939a48226
9 changed files with 8 additions and 19 deletions

View File

@ -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)

View File

@ -7,4 +7,3 @@ add_executable(${exe_name}
DHT_bootstrap.c)
linkCoreLibraries(${exe_name})
addCompilerFlags()

View File

@ -6,5 +6,4 @@ set(exe_name DHT_cryptosendfiletest)
add_executable(${exe_name}
DHT_cryptosendfiletest.c)
linkCoreLibraries(${exe_name})
addCompilerFlags()
linkCoreLibraries(${exe_name})

View File

@ -7,4 +7,3 @@ add_executable(${exe_name}
DHT_sendfiletest.c)
linkCoreLibraries(${exe_name})
addCompilerFlags()

View File

@ -7,4 +7,3 @@ add_executable(${exe_name}
DHT_test.c)
linkCoreLibraries(${exe_name})
addCompilerFlags()

View File

@ -7,4 +7,3 @@ add_executable(${exe_name}
Lossless_UDP_testclient.c)
linkCoreLibraries(${exe_name})
addCompilerFlags()

View File

@ -7,4 +7,3 @@ add_executable(${exe_name}
Lossless_UDP_testserver.c)
linkCoreLibraries(${exe_name})
addCompilerFlags()

View File

@ -7,4 +7,3 @@ add_executable(${exe_name}
Messenger_test.c)
linkCoreLibraries(${exe_name})
addCompilerFlags()

View File

@ -9,4 +9,3 @@ add_executable(${exe_name}
target_link_libraries(${exe_name} ncurses)
linkCoreLibraries(${exe_name})
addCompilerFlags()