* Get GCC version and add some compiler flags conditionally based on it. Dedicated to Dmitry.

svn path=/trunk/; revision=55870
This commit is contained in:
Amine Khaldi 2012-02-25 22:01:20 +00:00
parent 183b2632a2
commit 04e46d06af
2 changed files with 12 additions and 1 deletions

View file

@ -27,7 +27,15 @@ else()
endif()
# Warnings
add_compile_flags("-Wall -Wno-char-subscripts -Wpointer-arith -Wno-multichar -Wno-error=uninitialized -Wno-unused-value")
add_compile_flags("-Wall -Wno-char-subscripts -Wpointer-arith -Wno-multichar -Wno-unused-value")
if(GCC_VERSION VERSION_LESS 4.6)
add_compile_flags("-Wno-error=uninitialized")
elseif((GCC_VERSION VERSION_GREATER 4.6 OR GCC_VERSION VERSION_EQUAL 4.6) AND GCC_VERSION VERSION_LESS 4.7)
add_compile_flags("-Wno-error=unused-but-set-variable -Wno-error=uninitialized")
elseif(GCC_VERSION VERSION_EQUAL 4.7 OR GCC_VERSION VERSION_GREATER 4.7)
add_compile_flags("-Wno-error=unused-but-set-variable -Wno-error=maybe-uninitialized -Wno-error=delete-non-virtual-dtor -Wno-error=narrowing")
endif()
if(ARCH MATCHES amd64)
add_compile_flags("-Wno-format")

View file

@ -56,3 +56,6 @@ set(CMAKE_C_STANDARD_LIBRARIES "-lgcc" CACHE STRING "Standard C Libraries")
set(CMAKE_CXX_STANDARD_LIBRARIES "" CACHE STRING "Standard C++ Libraries")
set(CMAKE_SHARED_LINKER_FLAGS_INIT "-nostdlib -Wl,--enable-auto-image-base,--disable-auto-import")
# Get GCC version
execute_process(COMMAND ${CMAKE_C_COMPILER} -dumpversion OUTPUT_VARIABLE GCC_VERSION)