mirror of
https://github.com/libevent/libevent.git
synced 2025-01-09 00:56:20 +08:00
cmake: fix adding of compiler flags, and now it will
- add_compiler_flags() must accept array IOW just ARGN will be enoough - add_compiler_flags() called with variable name instead of it's value P.S. and fix some alignments issues P.P.S. more cmake issues expected since now CFLAGS actually works P.P.P.S. some issues with cmake cache is possible, so just reset it
This commit is contained in:
parent
f29f59e811
commit
36588e169d
@ -145,7 +145,7 @@ endif()
|
|||||||
# Setup compiler flags for coverage.
|
# Setup compiler flags for coverage.
|
||||||
if (EVENT__COVERAGE)
|
if (EVENT__COVERAGE)
|
||||||
if ((NOT CMAKE_COMPILER_IS_GNUCC) AND (NOT ${CMAKE_CXX_COMPILER_ID} STREQAL "Clang"))
|
if ((NOT CMAKE_COMPILER_IS_GNUCC) AND (NOT ${CMAKE_CXX_COMPILER_ID} STREQAL "Clang"))
|
||||||
message(FATAL_ERROR"Trying to compile coverage support, but compiler is not GNU gcc! Try CC=/usr/bin/gcc CXX=/usr/bin/g++ cmake <options> ..")
|
message(FATAL_ERROR "Trying to compile coverage support, but compiler is not GNU gcc! Try CC=/usr/bin/gcc CXX=/usr/bin/g++ cmake <options> ..")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(NOT CMAKE_BUILD_TYPE STREQUAL "Debug")
|
if(NOT CMAKE_BUILD_TYPE STREQUAL "Debug")
|
||||||
@ -193,14 +193,15 @@ if (CMAKE_COMPILER_IS_GNUCC)
|
|||||||
# have -fno-strict-aliasing
|
# have -fno-strict-aliasing
|
||||||
list(APPEND __FLAGS -fno-strict-aliasing)
|
list(APPEND __FLAGS -fno-strict-aliasing)
|
||||||
|
|
||||||
add_compiler_flags(__FLAGS)
|
add_compiler_flags(${__FLAGS})
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if (APPLE)
|
if (APPLE)
|
||||||
# Get rid of deprecated warnings for OpenSSL on OSX 10.7 and greater.
|
# Get rid of deprecated warnings for OpenSSL on OSX 10.7 and greater.
|
||||||
add_compiler_flags(
|
add_compiler_flags(
|
||||||
-Wno-error=deprecated-declarations
|
-Wno-error=deprecated-declarations
|
||||||
-Qunused-arguments)
|
-Qunused-arguments
|
||||||
|
)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# Winsock.
|
# Winsock.
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
include(CheckCCompilerFlag)
|
include(CheckCCompilerFlag)
|
||||||
|
|
||||||
macro(add_compiler_flags _flags)
|
macro(add_compiler_flags)
|
||||||
foreach(flag ${_flags})
|
foreach(flag ${ARGN})
|
||||||
string(REGEX REPLACE "[-.+/:= ]" "_" _flag_esc "${flag}")
|
string(REGEX REPLACE "[-.+/:= ]" "_" _flag_esc "${flag}")
|
||||||
|
|
||||||
check_c_compiler_flag("${flag}" check_c_compiler_flag_${_flag_esc})
|
check_c_compiler_flag("${flag}" check_c_compiler_flag_${_flag_esc})
|
||||||
@ -11,5 +11,3 @@ macro(add_compiler_flags _flags)
|
|||||||
endif()
|
endif()
|
||||||
endforeach()
|
endforeach()
|
||||||
endmacro()
|
endmacro()
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user