Salome HOME
merge from BR_KERNEL_REFACTORING
[modules/kernel.git] / salome_adm / cmake_files / FindPLATFORM.cmake
index b6a36caca27d8c313f214e38f108eaa3a41165c3..fa06d0ec3b343041ebc5b6d59611342819d5a6e6 100644 (file)
@@ -79,29 +79,55 @@ IF(CMAKE_BUILD_TYPE)
   ENDIF(WINDOWS)
 ENDIF(CMAKE_BUILD_TYPE)
 
-SET(PLATFORM_CPPFLAGS)
-SET(PLATFORM_LDFLAGS)
-SET(PLATFORM_LIBADD)
+SET(PLATFORM_CPPFLAGS) # to be removed
+SET(PLATFORM_LDFLAGS) # to be removed
+SET(PLATFORM_LIBADD) # to be removed
+
+SET(PLATFORM_LIBS)
+SET(PLATFORM_DEFINITIONS)
+
 IF(WINDOWS)
-  SET(PLATFORM_CPPFLAGS ${PLATFORM_CPPFLAGS} /W0)
-  SET(PLATFORM_CPPFLAGS ${PLATFORM_CPPFLAGS} -D_CRT_SECURE_NO_WARNINGS)  # To disable windows warnings for strcpy, fopen, ...
-  SET(PLATFORM_CPPFLAGS ${PLATFORM_CPPFLAGS} -D_SCL_SECURE_NO_WARNINGS)  # To disable windows warnings std::copy, std::transform, ...
-  SET(PLATFORM_CPPFLAGS ${PLATFORM_CPPFLAGS} -DWNT)
-  SET(PLATFORM_CPPFLAGS ${PLATFORM_CPPFLAGS} -DPPRO_NT) # For medfile
-  SET(PLATFORM_CPPFLAGS ${PLATFORM_CPPFLAGS} -D_USE_MATH_DEFINES) # At least for MEDMEM
-  SET(PLATFORM_CPPFLAGS ${PLATFORM_CPPFLAGS} -D_WIN32_WINNT=0x0500) # Windows 2000 or later API is required
-  SET(PLATFORM_LIBADD ${PLATFORM_LIBADD} Ws2_32.lib)
-  SET(PLATFORM_LIBADD ${PLATFORM_LIBADD} Userenv.lib) # At least for GEOM suit
+  SET(PLATFORM_CPPFLAGS ${PLATFORM_CPPFLAGS} /W0) # to be removed
+  SET(PLATFORM_CPPFLAGS ${PLATFORM_CPPFLAGS} -D_CRT_SECURE_NO_WARNINGS)  # To disable windows warnings for strcpy, fopen, ... # to be removed
+  SET(PLATFORM_CPPFLAGS ${PLATFORM_CPPFLAGS} -D_SCL_SECURE_NO_WARNINGS)  # To disable windows warnings std::copy, std::transform, ... # to be removed
+  SET(PLATFORM_CPPFLAGS ${PLATFORM_CPPFLAGS} -DWNT) # to be removed
+  SET(PLATFORM_CPPFLAGS ${PLATFORM_CPPFLAGS} -DPPRO_NT) # For medfile # to be removed
+  SET(PLATFORM_CPPFLAGS ${PLATFORM_CPPFLAGS} -D_USE_MATH_DEFINES) # At least for MEDMEM # to be removed
+  SET(PLATFORM_CPPFLAGS ${PLATFORM_CPPFLAGS} -D_WIN32_WINNT=0x0500) # Windows 2000 or later API is required # to be removed
+  SET(PLATFORM_LIBADD ${PLATFORM_LIBADD} Ws2_32.lib) # to be removed
+  SET(PLATFORM_LIBADD ${PLATFORM_LIBADD} Userenv.lib) # At least for GEOM suit # to be removed
+
+  SET(PLATFORM_DEFINITIONS "${PLATFORM_DEFINITIONS} /W0")
+  SET(PLATFORM_DEFINITIONS "${PLATFORM_DEFINITIONS} -D_CRT_SECURE_NO_WARNINGS")  # To disable windows warnings for strcpy, fopen, ...
+  SET(PLATFORM_DEFINITIONS "${PLATFORM_DEFINITIONS} -D_SCL_SECURE_NO_WARNINGS")  # To disable windows warnings std::copy, std::transform, ...
+  SET(PLATFORM_DEFINITIONS "${PLATFORM_DEFINITIONS} -DWNT")
+  SET(PLATFORM_DEFINITIONS "${PLATFORM_DEFINITIONS} -DPPRO_NT") # For medfile 
+  SET(PLATFORM_DEFINITIONS "${PLATFORM_DEFINITIONS} -D_USE_MATH_DEFINES") # At least for MEDMEM
+  SET(PLATFORM_DEFINITIONS "${PLATFORM_DEFINITIONS} -D_WIN32_WINNT=0x0500") # Windows 2000 or later API is required
+  SET(PLATFORM_LIBS ${PLATFORM_LIBS} Ws2_32.lib)
+  SET(PLATFORM_LIBS ${PLATFORM_LIBS} Userenv.lib) # At least for GEOM suit
+
+  IF("${CMAKE_SIZEOF_VOID_P}" EQUAL "8")          # if platform is Windows 64 bit 
+    SET(PLATFORM_CPPFLAGS "${PLATFORM_CPPFLAGS} -D_SECURE_SCL=0 -D_SECURE_SCL_THROWS=0 -D_HAS_ITERATOR_DEBUGGING=0") # To avoid runtime error during checking iterators  # to be removed
+    SET(PLATFORM_DEFINITIONS "${PLATFORM_DEFINITIONS} -D_SECURE_SCL=0 -D_SECURE_SCL_THROWS=0 -D_HAS_ITERATOR_DEBUGGING=0") # To avoid runtime error during checking iterators 
+  ENDIF("${CMAKE_SIZEOF_VOID_P}" EQUAL "8")
 ELSE(WINDOWS)
   # SET(PLATFORM_CPPFLAGS ${PLATFORM_CPPFLAGS} -Wparentheses)
   # SET(PLATFORM_CPPFLAGS ${PLATFORM_CPPFLAGS} -Wreturn-type)
   # SET(PLATFORM_CPPFLAGS ${PLATFORM_CPPFLAGS} -Wmissing-declarations)
   # SET(PLATFORM_CPPFLAGS ${PLATFORM_CPPFLAGS} -Wunused)
   # SET(PLATFORM_CPPFLAGS ${PLATFORM_CPPFLAGS} -Wall)
-  SET(PLATFORM_LIBADD ${PLATFORM_LIBADD} -ldl)
+  SET(PLATFORM_LIBADD ${PLATFORM_LIBADD} -ldl) # to be removed
+  SET(PLATFORM_LIBS ${PLATFORM_LIBS} -ldl)
 ENDIF(WINDOWS)
 
-SET(PLATFORM_CPPFLAGS ${PLATFORM_CPPFLAGS} -DSIZEOF_FORTRAN_INTEGER=4 -DSIZEOF_LONG=${CMAKE_SIZEOF_VOID_P} -DSIZEOF_INT=4)
+SET(SIZE_OF_LONG ${CMAKE_SIZEOF_VOID_P})            # set sizeof(long) the same as size of pointers, because on all memory models (EXCLUDING WINDOWS 64 bit) it is equivalent values
+IF("${CMAKE_SIZEOF_VOID_P}" EQUAL "8"  AND WINDOWS) # if it platform Windows 64 bit
+  SET(SIZE_OF_LONG "4")                             # set sizeof(long) to 4 byte
+ENDIF("${CMAKE_SIZEOF_VOID_P}" EQUAL "8"  AND WINDOWS)
+
+SET(PLATFORM_CPPFLAGS "${PLATFORM_CPPFLAGS} -DSIZEOF_FORTRAN_INTEGER=4 -DSIZEOF_LONG=${SIZE_OF_LONG} -DSIZEOF_INT=4") # to be removed
+SET(PLATFORM_DEFINITIONS "${PLATFORM_DEFINITIONS} -DSIZEOF_FORTRAN_INTEGER=4 -DSIZEOF_LONG=${SIZE_OF_LONG} -DSIZEOF_INT=4")
 
 SET(COMPILATION_WITH_CMAKE ON)