Salome HOME
Update copyrights 2014.
[modules/kernel.git] / salome_adm / cmake_files / SalomeSetupPlatform.cmake
index 226f38c7d849305c51951c8424a272391c92fc03..2a0ab0823f64cb3bb92d5202cd66522280ced498 100644 (file)
@@ -1,9 +1,9 @@
-# Copyright (C) 2007-2013  CEA/DEN, EDF R&D, OPEN CASCADE
+# Copyright (C) 2007-2014  CEA/DEN, EDF R&D, OPEN CASCADE
 #
 # This library is free software; you can redistribute it and/or
 # modify it under the terms of the GNU Lesser General Public
 # License as published by the Free Software Foundation; either
-# version 2.1 of the License.
+# version 2.1 of the License, or (at your option) any later version.
 #
 # This library is distributed in the hope that it will be useful,
 # but WITHOUT ANY WARRANTY; without even the implied warranty of
@@ -85,7 +85,7 @@ ENDIF()
 IF(WIN32)
   ## Windows specific:  
   ADD_DEFINITIONS(-D_CRT_SECURE_NO_WARNINGS)  # To disable windows warnings for strcpy, fopen, ...
-  ADD_DEFINITIONS(-D_SCL_SECURE_NO_WARNINGS)  # To disable windows warnings std::copy, std::transform, ...
+  ADD_DEFINITIONS(-D_SCL_SECURE_NO_WARNINGS)  # To disable windows warnings generated by checked iterators(e.g. std::copy, std::transform, ...)
   ADD_DEFINITIONS(-DWNT -DWIN32)
   ADD_DEFINITIONS(-D_WIN32_WINNT=0x0500)      # Windows 2000 or later API is required
   ADD_DEFINITIONS(-DPPRO_NT)                  # For medfile
@@ -93,10 +93,29 @@ IF(WIN32)
     
   SET(PLATFORM_LIBS Ws2_32.lib)
   LIST(APPEND PLATFORM_LIBS Userenv.lib)      # At least for GEOM suit
+
+  # Disable iterator debugging on WINDOWS to avoid runtime error during checking iterators
+    # _SECURE_SCL 
+    #             If defined as 1, unsafe iterator use causes a runtime error. 
+    #             If defined as 0, checked iterators are disabled.
+    #             The default value for _SECURE_SCL is 1
+    # _SECURE_SCL_THROWS
+    #             If defined as 1, an out of range iterator use causes an exception at runtime.
+    #             If defined as 0, the program is terminated by calling invalid_parameter. 
+    #             The default value for _SECURE_SCL_THROWS is 0
+  
+  ADD_DEFINITIONS(-D_SECURE_SCL=0 -D_SECURE_SCL_THROWS=0)
+
+    # The symbol _HAS_ITERATOR_DEBUGGING can be used to turn off the iterator debugging feature in a debug build
+    #             If defined as 1, iterator debugging is enabled. 
+    #             If defined as 0, iterator debugging is disabled.
+    #             The default value for _HAS_ITERATOR_DEBUGGING is 1
+
+  IF(NOT CMAKE_BUILD_TYPE STREQUAL "RELEASE" AND NOT CMAKE_BUILD_TYPE STREQUAL "Release")
+    ADD_DEFINITIONS(-D_HAS_ITERATOR_DEBUGGING=0)  
+  ENDIF(NOT CMAKE_BUILD_TYPE STREQUAL "RELEASE" AND NOT CMAKE_BUILD_TYPE STREQUAL "Release")
   
   IF(MACHINE_IS_64)
-    ADD_DEFINITIONS(-D_SECURE_SCL=0 -D_SECURE_SCL_THROWS=0)
-    ADD_DEFINITIONS(-D_HAS_ITERATOR_DEBUGGING=0) # To avoid runtime error during checking iterators
     SET(SIZE_OF_LONG 4)                          # set sizeof(long) to 4 byte
   ELSE()
     SET(SIZE_OF_LONG ${CMAKE_SIZEOF_VOID_P})     # set sizeof(long) the same as size of pointers