1 # Distributed under the OSI-approved BSD 3-Clause License. See accompanying
2 # file Copyright.txt or https://cmake.org/licensing for details.
4 #-----------------------------------------------------------------------------
5 # set some special flags for different compilers
7 if(WIN32 AND CMAKE_C_COMPILER_ID STREQUAL "Intel")
11 # Disable deprecation warnings for standard C functions.
12 # really only needed for newer versions of VS, but should
13 # not hurt other versions, and this will work into the
15 if(MSVC OR _INTEL_WINDOWS)
16 add_definitions(-D_CRT_SECURE_NO_DEPRECATE -D_CRT_NONSTDC_NO_DEPRECATE)
20 #silence duplicate symbol warnings on AIX
21 if(CMAKE_SYSTEM_NAME MATCHES "AIX")
22 if(NOT CMAKE_COMPILER_IS_GNUCXX)
23 set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -bhalt:5 ")
27 if(CMAKE_SYSTEM_NAME MATCHES "IRIX")
28 if(NOT CMAKE_COMPILER_IS_GNUCXX)
29 set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wl,-woff84 -no_auto_include")
30 set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,-woff15")
34 if(CMAKE_SYSTEM MATCHES "OSF1-V")
35 if(NOT CMAKE_COMPILER_IS_GNUCXX)
36 set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -timplicit_local -no_implicit_include ")
40 # Workaround for short jump tables on PA-RISC
41 if(CMAKE_SYSTEM_PROCESSOR MATCHES "^parisc")
42 if(CMAKE_COMPILER_IS_GNUCC)
43 set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -mlong-calls")
45 if(CMAKE_COMPILER_IS_GNUCXX)
46 set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mlong-calls")
50 if (CMAKE_CXX_COMPILER_ID STREQUAL SunPro AND
51 NOT DEFINED CMAKE_CXX${CMAKE_CXX_STANDARD}_STANDARD_COMPILE_OPTION)
52 if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 5.13)
53 if (NOT CMAKE_CXX_STANDARD OR CMAKE_CXX_STANDARD EQUAL 98)
54 set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++03")
55 elseif(CMAKE_VERSION VERSION_LESS 3.8.20170502)
56 # CMake knows how to add this flag for compilation as C++11,
57 # but has not been taught that SunPro needs it for linking too.
58 # Add it in a place that will be used for both.
59 set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
62 set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -library=stlport4")
67 # Suppress warnings from PGI compiler.
68 if (CMAKE_${lang}_COMPILER_ID STREQUAL "PGI")
69 set(CMAKE_${lang}_FLAGS "${CMAKE_${lang}_FLAGS} -w")
73 # use the ansi CXX compile flag for building cmake
74 if (CMAKE_ANSI_CXXFLAGS)
75 set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${CMAKE_ANSI_CXXFLAGS}")
78 if (CMAKE_ANSI_CFLAGS)
79 set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${CMAKE_ANSI_CFLAGS}")