1 # Copyright (C) 2007-2013 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
20 MARK_AS_ADVANCED(ISSUE)
21 FIND_FILE(ISSUE issue /etc)
34 SET(CMAKE_INSTALL_PREFIX_ENV $ENV{CMAKE_INSTALL_PREFIX})
35 IF(CMAKE_INSTALL_PREFIX_ENV)
36 SET(CMAKE_INSTALL_PREFIX ${CMAKE_INSTALL_PREFIX_ENV} CACHE PATH "installation prefix" FORCE)
37 ENDIF(CMAKE_INSTALL_PREFIX_ENV)
39 IF(NOT CMAKE_BUILD_TYPE)
40 SET(CMAKE_BUILD_TYPE $ENV{CMAKE_BUILD_TYPE})
41 ENDIF(NOT CMAKE_BUILD_TYPE)
43 IF(NOT CMAKE_BUILD_TYPE)
44 SET(CMAKE_BUILD_TYPE Release)
45 ENDIF(NOT CMAKE_BUILD_TYPE)
50 SET(NAMES ACCEPT_SALOME_WARNINGS ACCEPT_${MODULE}_WARNINGS I_AM_A_TROLL_I_DO_NOT_FIX_${MODULE}_WARNINGS)
51 FOREACH(name ${NAMES})
52 SET(VAL $ENV{${name}})
53 IF(X${VAL} STREQUAL X0)
55 ENDIF(X${VAL} STREQUAL X0)
56 IF(X${VAL} STREQUAL X1)
58 ENDIF(X${VAL} STREQUAL X1)
59 ENDFOREACH(name ${NAMES})
61 SET(CMAKE_C_FLAGS "-Werror")
62 SET(CMAKE_CXX_FLAGS "-Werror")
68 MARK_AS_ADVANCED(CLEAR CMAKE_CONFIGURATION_TYPES)
69 SET(CMAKE_CONFIGURATION_TYPES ${CMAKE_BUILD_TYPE} CACHE STRING "compilation types" FORCE)
71 IF(CMAKE_BUILD_TYPE STREQUAL Debug)
72 SET(CMAKE_C_FLAGS_DEBUG "-g")
73 SET(CMAKE_CXX_FLAGS_DEBUG "-g")
74 ENDIF(CMAKE_BUILD_TYPE STREQUAL Debug)
75 IF(CMAKE_BUILD_TYPE STREQUAL Release)
76 SET(CMAKE_C_FLAGS_RELEASE "-O1 -DNDEBUG")
77 SET(CMAKE_CXX_FLAGS_RELEASE "-O1 -DNDEBUG")
78 ENDIF(CMAKE_BUILD_TYPE STREQUAL Release)
80 ENDIF(CMAKE_BUILD_TYPE)
82 SET(PLATFORM_CPPFLAGS) # to be removed
83 SET(PLATFORM_LDFLAGS) # to be removed
84 SET(PLATFORM_LIBADD) # to be removed
87 SET(PLATFORM_DEFINITIONS)
90 SET(PLATFORM_CPPFLAGS ${PLATFORM_CPPFLAGS} /W0) # to be removed
91 SET(PLATFORM_CPPFLAGS ${PLATFORM_CPPFLAGS} -D_CRT_SECURE_NO_WARNINGS) # To disable windows warnings for strcpy, fopen, ... # to be removed
92 SET(PLATFORM_CPPFLAGS ${PLATFORM_CPPFLAGS} -D_SCL_SECURE_NO_WARNINGS) # To disable windows warnings std::copy, std::transform, ... # to be removed
93 SET(PLATFORM_CPPFLAGS ${PLATFORM_CPPFLAGS} -DWNT) # to be removed
94 SET(PLATFORM_CPPFLAGS ${PLATFORM_CPPFLAGS} -DPPRO_NT) # For medfile # to be removed
95 SET(PLATFORM_CPPFLAGS ${PLATFORM_CPPFLAGS} -D_USE_MATH_DEFINES) # At least for MEDMEM # to be removed
96 SET(PLATFORM_CPPFLAGS ${PLATFORM_CPPFLAGS} -D_WIN32_WINNT=0x0500) # Windows 2000 or later API is required # to be removed
97 SET(PLATFORM_LIBADD ${PLATFORM_LIBADD} Ws2_32.lib) # to be removed
98 SET(PLATFORM_LIBADD ${PLATFORM_LIBADD} Userenv.lib) # At least for GEOM suit # to be removed
100 SET(PLATFORM_DEFINITIONS "${PLATFORM_DEFINITIONS} /W0")
101 SET(PLATFORM_DEFINITIONS "${PLATFORM_DEFINITIONS} -D_CRT_SECURE_NO_WARNINGS") # To disable windows warnings for strcpy, fopen, ...
102 SET(PLATFORM_DEFINITIONS "${PLATFORM_DEFINITIONS} -D_SCL_SECURE_NO_WARNINGS") # To disable windows warnings std::copy, std::transform, ...
103 SET(PLATFORM_DEFINITIONS "${PLATFORM_DEFINITIONS} -DWNT")
104 SET(PLATFORM_DEFINITIONS "${PLATFORM_DEFINITIONS} -DPPRO_NT") # For medfile
105 SET(PLATFORM_DEFINITIONS "${PLATFORM_DEFINITIONS} -D_USE_MATH_DEFINES") # At least for MEDMEM
106 SET(PLATFORM_DEFINITIONS "${PLATFORM_DEFINITIONS} -D_WIN32_WINNT=0x0500") # Windows 2000 or later API is required
107 SET(PLATFORM_LIBS ${PLATFORM_LIBS} Ws2_32.lib)
108 SET(PLATFORM_LIBS ${PLATFORM_LIBS} Userenv.lib) # At least for GEOM suit
110 IF("${CMAKE_SIZEOF_VOID_P}" EQUAL "8") # if platform is Windows 64 bit
111 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
112 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
113 ENDIF("${CMAKE_SIZEOF_VOID_P}" EQUAL "8")
115 # SET(PLATFORM_CPPFLAGS ${PLATFORM_CPPFLAGS} -Wparentheses)
116 # SET(PLATFORM_CPPFLAGS ${PLATFORM_CPPFLAGS} -Wreturn-type)
117 # SET(PLATFORM_CPPFLAGS ${PLATFORM_CPPFLAGS} -Wmissing-declarations)
118 # SET(PLATFORM_CPPFLAGS ${PLATFORM_CPPFLAGS} -Wunused)
119 # SET(PLATFORM_CPPFLAGS ${PLATFORM_CPPFLAGS} -Wall)
120 SET(PLATFORM_LIBADD ${PLATFORM_LIBADD} -ldl) # to be removed
121 SET(PLATFORM_LIBS ${PLATFORM_LIBS} -ldl)
124 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
125 IF("${CMAKE_SIZEOF_VOID_P}" EQUAL "8" AND WINDOWS) # if it platform Windows 64 bit
126 SET(SIZE_OF_LONG "4") # set sizeof(long) to 4 byte
127 ENDIF("${CMAKE_SIZEOF_VOID_P}" EQUAL "8" AND WINDOWS)
129 SET(PLATFORM_CPPFLAGS "${PLATFORM_CPPFLAGS} -DSIZEOF_FORTRAN_INTEGER=4 -DSIZEOF_LONG=${SIZE_OF_LONG} -DSIZEOF_INT=4") # to be removed
130 SET(PLATFORM_DEFINITIONS "${PLATFORM_DEFINITIONS} -DSIZEOF_FORTRAN_INTEGER=4 -DSIZEOF_LONG=${SIZE_OF_LONG} -DSIZEOF_INT=4")
132 SET(COMPILATION_WITH_CMAKE ON)
134 # SET(PLATFORM_CPPFLAGS)
135 # # # SET(PLATFORM_CPPFLAGS ${PLATFORM_CPPFLAGS} -DWNT -D_CRT_SECURE_NO_WARNINGS)
141 ### SET(PLATFORM_CPPFLAGS ${PLATFORM_CPPFLAGS} -D_DEBUG_)
147 ## MESSAGE(FATAL_ERROR "ZZZZZZZ")