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) 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) if(WIN32)
include_directories(${CMAKE_HOME_DIRECTORY}/sodium/include/) include_directories(${CMAKE_HOME_DIRECTORY}/sodium/include/)
endif() endif()
@ -24,15 +31,5 @@ macro(linkCoreLibraries exe_name)
endif() endif()
endmacro() 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(testing)
ADD_SUBDIRECTORY(other) ADD_SUBDIRECTORY(other)

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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