From 3f838c557bd004d610b271e69147a7cd2be09186 Mon Sep 17 00:00:00 2001
From: Thomas Feuvrier <thomas.feuvrier@c-s.fr>
Date: Fri, 19 May 2006 13:10:00 +0000
Subject: [PATCH] nomsg

---
 CMakeLists.txt | 26 ++++++++++++++++++++++++++
 1 file changed, 26 insertions(+)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index a14e33a1a3..ce163a5a8d 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -503,3 +503,29 @@ SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${OTB_REQUIRED_LINK_FLAGS}
 SET(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} ${OTB_REQUIRED_LINK_FLAGS}")
 SET(CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} ${OTB_REQUIRED_LINK_FLAGS}")
 
+#-----------------------------------------------------------------------------
+# The frename-registers option does not work due to a bug in the gnu compiler.
+# It must be removed or data errors will be produced and incorrect results
+# will be produced.  This is first documented in the gcc4 man page.
+IF(CMAKE_COMPILER_IS_GNUCXX)
+  SET(ALL_FLAGS "${CMAKE_C_FLAGS} ${CMAKE_CXX_FLAGS} ${CMAKE_EXE_LINKER_FLAGS} ${CMAKE_SHARED_LINKER_FLAGS} ${CMAKE_MODULE_LINKER_FLAGS}" )
+  SEPARATE_ARGUMENTS(ALL_FLAGS)
+  FOREACH(COMP_OPTION ${ALL_FLAGS})
+    #  MESSAGE("${COMP_OPTION} being checked.")
+    IF("${COMP_OPTION}" STREQUAL "-frename-registers")
+      MESSAGE(FATAL_ERROR "-frename-registers causes runtime bugs.  It must be removed from your compilation options.")
+    ENDIF("${COMP_OPTION}" STREQUAL "-frename-registers")
+    IF("${COMP_OPTION}" STREQUAL "-ffloat-store")
+      MESSAGE(FATAL_ERROR "-ffloat-store causes runtime bugs on gcc 3.2.3 (appearently not on gcc 3.4.3, but the exact criteria is not known).  It must be removed from your compilation options.")
+    ENDIF("${COMP_OPTION}" STREQUAL "-ffloat-store")
+  ENDFOREACH(COMP_OPTION)
+ENDIF(CMAKE_COMPILER_IS_GNUCXX)
+
+# If the version of CMake was too old, complain and build nothing.
+# These should be the last lines in this file.
+ELSE("${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}" GREATER 1.7)
+  MESSAGE(SEND_ERROR
+          "This version of CMake is too old to build this version of OTB.  "
+          "Please upgrade to CMake 1.8.")
+ENDIF("${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}" GREATER 1.7)
+
-- 
GitLab