Imported Upstream version 2.8.11.2
[platform/upstream/cmake.git] / CompileFlags.cmake
1 #=============================================================================
2 # CMake - Cross Platform Makefile Generator
3 # Copyright 2000-2009 Kitware, Inc., Insight Software Consortium
4 #
5 # Distributed under the OSI-approved BSD License (the "License");
6 # see accompanying file Copyright.txt for details.
7 #
8 # This software is distributed WITHOUT ANY WARRANTY; without even the
9 # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
10 # See the License for more information.
11 #=============================================================================
12
13 #-----------------------------------------------------------------------------
14 # set some special flags for different compilers
15 #
16 if(CMAKE_GENERATOR MATCHES "Visual Studio 7")
17   set(CMAKE_SKIP_COMPATIBILITY_TESTS 1)
18 endif()
19 if(CMAKE_GENERATOR MATCHES "Visual Studio 6")
20   set(CMAKE_SKIP_COMPATIBILITY_TESTS 1)
21 endif()
22 include (${CMAKE_ROOT}/Modules/CMakeBackwardCompatibilityCXX.cmake)
23
24 if(WIN32 AND "${CMAKE_C_COMPILER_ID}" MATCHES "^(Intel)$")
25   set(_INTEL_WINDOWS 1)
26 endif()
27
28 # Disable deprecation warnings for standard C functions.
29 # really only needed for newer versions of VS, but should
30 # not hurt other versions, and this will work into the
31 # future
32 if(MSVC OR _INTEL_WINDOWS)
33   add_definitions(-D_CRT_SECURE_NO_DEPRECATE -D_CRT_NONSTDC_NO_DEPRECATE)
34 else()
35 endif()
36
37 #silence duplicate symbol warnings on AIX
38 if(CMAKE_SYSTEM MATCHES "AIX.*")
39   if(NOT CMAKE_COMPILER_IS_GNUCXX)
40     set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -bhalt:5 ")
41   endif()
42 endif()
43
44 if(CMAKE_SYSTEM MATCHES "IRIX.*")
45   if(NOT CMAKE_COMPILER_IS_GNUCXX)
46     set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wl,-woff84 -no_auto_include")
47     set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,-woff15")
48   endif()
49 endif()
50
51 if(CMAKE_SYSTEM MATCHES "OSF1-V.*")
52   if(NOT CMAKE_COMPILER_IS_GNUCXX)
53     set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -timplicit_local -no_implicit_include ")
54   endif()
55 endif()
56
57 # use the ansi CXX compile flag for building cmake
58 if (CMAKE_ANSI_CXXFLAGS)
59   set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${CMAKE_ANSI_CXXFLAGS}")
60 endif ()
61
62 if (CMAKE_ANSI_CFLAGS)
63   set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${CMAKE_ANSI_CFLAGS}")
64 endif ()
65
66 # avoid binutils problem with large binaries, e.g. when building CMake in debug mode
67 # See http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50230
68 if (CMAKE_SYSTEM_NAME STREQUAL Linux AND CMAKE_SYSTEM_PROCESSOR STREQUAL parisc)
69   set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,--unique=.text.*")
70 endif ()