1 # Copyright (C) 2007-2012 CEA/DEN, EDF R&D, OPEN CASCADE
3 # This library is free software; you can redistribute it and/or
4 # modify it under the terms of the GNU Lesser General Public
5 # License as published by the Free Software Foundation; either
6 # version 2.1 of the License.
8 # This library is distributed in the hope that it will be useful,
9 # but WITHOUT ANY WARRANTY; without even the implied warranty of
10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 # Lesser General Public License for more details.
13 # You should have received a copy of the GNU Lesser General Public
14 # License along with this library; if not, write to the Free Software
15 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
26 IF(NOT CMAKE_BUILD_TYPE)
27 SET(CMAKE_BUILD_TYPE $ENV{CMAKE_BUILD_TYPE})
28 ENDIF(NOT CMAKE_BUILD_TYPE)
30 IF(NOT CMAKE_BUILD_TYPE)
31 SET(CMAKE_BUILD_TYPE Release)
32 ENDIF(NOT CMAKE_BUILD_TYPE)
35 ELSE(WINDOWS OR APPLE)
37 SET(NAMES ACCEPT_SALOME_WARNINGS ACCEPT_${MODULE}_WARNINGS I_AM_A_TROLL_I_DO_NOT_FIX_${MODULE}_WARNINGS)
38 FOREACH(name ${NAMES})
39 SET(VAL $ENV{${name}})
40 IF(X${VAL} STREQUAL X0)
42 ENDIF(X${VAL} STREQUAL X0)
43 IF(X${VAL} STREQUAL X1)
45 ENDIF(X${VAL} STREQUAL X1)
46 ENDFOREACH(name ${NAMES})
48 # SET(CMAKE_C_FLAGS "-Werror")
49 # SET(CMAKE_CXX_FLAGS "-Werror")
51 ENDIF(WINDOWS OR APPLE)
55 MARK_AS_ADVANCED(CLEAR CMAKE_CONFIGURATION_TYPES)
56 SET(CMAKE_CONFIGURATION_TYPES ${CMAKE_BUILD_TYPE} CACHE STRING "compilation types" FORCE)
58 IF(CMAKE_BUILD_TYPE STREQUAL Debug)
59 SET(CMAKE_C_FLAGS_DEBUG "-g")
60 SET(CMAKE_CXX_FLAGS_DEBUG "-g")
61 ENDIF(CMAKE_BUILD_TYPE STREQUAL Debug)
62 IF(CMAKE_BUILD_TYPE STREQUAL Release)
63 SET(CMAKE_C_FLAGS_RELEASE "-O1 -DNDEBUG")
64 SET(CMAKE_CXX_FLAGS_RELEASE "-O1 -DNDEBUG")
65 ENDIF(CMAKE_BUILD_TYPE STREQUAL Release)
67 ENDIF(CMAKE_BUILD_TYPE)
70 SET(PLATFORM_DEFINITIONS)
73 SET(PLATFORM_DEFINITIONS "${PLATFORM_DEFINITIONS} /W0")
74 SET(PLATFORM_DEFINITIONS "${PLATFORM_DEFINITIONS} -D_CRT_SECURE_NO_WARNINGS") # To disable windows warnings for strcpy, fopen, ...
75 SET(PLATFORM_DEFINITIONS "${PLATFORM_DEFINITIONS} -D_SCL_SECURE_NO_WARNINGS") # To disable windows warnings std::copy, std::transform, ...
76 SET(PLATFORM_DEFINITIONS "${PLATFORM_DEFINITIONS} -DWNT")
77 SET(PLATFORM_DEFINITIONS "${PLATFORM_DEFINITIONS} -DPPRO_NT") # For medfile
78 SET(PLATFORM_DEFINITIONS "${PLATFORM_DEFINITIONS} -D_USE_MATH_DEFINES") # At least for MEDMEM
79 SET(PLATFORM_DEFINITIONS "${PLATFORM_DEFINITIONS} -D_WIN32_WINNT=0x0500") # Windows 2000 or later API is required
80 SET(PLATFORM_LIBS ${PLATFORM_LIBS} Ws2_32.lib)
81 SET(PLATFORM_LIBS ${PLATFORM_LIBS} Userenv.lib) # At least for GEOM suit
83 IF("${CMAKE_SIZEOF_VOID_P}" EQUAL "8") # if platform is Windows 64 bit
84 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
85 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
86 ENDIF("${CMAKE_SIZEOF_VOID_P}" EQUAL "8")
88 SET(PLATFORM_LIBS ${PLATFORM_LIBS} -ldl)
91 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
92 IF("${CMAKE_SIZEOF_VOID_P}" EQUAL "8" AND WINDOWS) # if it platform Windows 64 bit
93 SET(SIZE_OF_LONG "4") # set sizeof(long) to 4 byte
94 ENDIF("${CMAKE_SIZEOF_VOID_P}" EQUAL "8" AND WINDOWS)
96 SET(PLATFORM_DEFINITIONS "${PLATFORM_DEFINITIONS} -DSIZEOF_FORTRAN_INTEGER=4 -DSIZEOF_LONG=${SIZE_OF_LONG} -DSIZEOF_INT=4")
97 ADD_DEFINITIONS(${PLATFORM_DEFINITIONS})
98 SET(COMPILATION_WITH_CMAKE ON)