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:
Azat Khuzhin 2016-03-10 00:33:04 +03:00
parent f29f59e811
commit 36588e169d
2 changed files with 21 additions and 22 deletions

View File

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

View File

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