Author: akhaldi
Date: Sat Feb 25 22:01:20 2012
New Revision: 55870
URL:
http://svn.reactos.org/svn/reactos?rev=55870&view=rev
Log:
[CMAKE]
* Get GCC version and add some compiler flags conditionally based on it. Dedicated to
Dmitry.
Modified:
trunk/reactos/cmake/gcc.cmake
trunk/reactos/toolchain-gcc.cmake
Modified: trunk/reactos/cmake/gcc.cmake
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/cmake/gcc.cmake?rev=55870&…
==============================================================================
--- trunk/reactos/cmake/gcc.cmake [iso-8859-1] (original)
+++ trunk/reactos/cmake/gcc.cmake [iso-8859-1] Sat Feb 25 22:01:20 2012
@@ -27,7 +27,15 @@
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")
Modified: trunk/reactos/toolchain-gcc.cmake
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/toolchain-gcc.cmake?rev=55…
==============================================================================
--- trunk/reactos/toolchain-gcc.cmake [iso-8859-1] (original)
+++ trunk/reactos/toolchain-gcc.cmake [iso-8859-1] Sat Feb 25 22:01:20 2012
@@ -56,3 +56,6 @@
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)