Fix warning with clang

/usr/include/features.h:330:4: error: _FORTIFY_SOURCE requires compiling
with optimization (-O) [-Werror,-W#warnings]
 #  warning _FORTIFY_SOURCE requires compiling with optimization (-O)
This commit is contained in:
Olivier Goffart 2013-08-01 11:09:35 +02:00 committed by Daniel Molkentin
parent 38403f3343
commit 3cc41db0bd

View file

@ -33,10 +33,12 @@ if (${CMAKE_C_COMPILER_ID} MATCHES "(GNU|Clang)")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fstack-protector")
endif (WITH_STACK_PROTECTOR AND NOT WIN32)
if (WITH_OPTIMIZATION)
check_c_compiler_flag("-D_FORTIFY_SOURCE=2" WITH_FORTIFY_SOURCE)
if (WITH_FORTIFY_SOURCE)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -D_FORTIFY_SOURCE=2")
endif (WITH_FORTIFY_SOURCE)
if (WITH_FORTIFY_SOURCE)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -O -D_FORTIFY_SOURCE=2")
endif (WITH_FORTIFY_SOURCE)
endif (WITH_OPTIMIZATION)
endif (${CMAKE_C_COMPILER_ID} MATCHES "(GNU|Clang)")
if (UNIX AND NOT WIN32)