CompileFlags.cmake 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  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. # set some special flags for different compilers
  14. #
  15. if(CMAKE_GENERATOR MATCHES "Visual Studio 7")
  16. set(CMAKE_SKIP_COMPATIBILITY_TESTS 1)
  17. endif()
  18. if(CMAKE_GENERATOR MATCHES "Visual Studio 6")
  19. set(CMAKE_SKIP_COMPATIBILITY_TESTS 1)
  20. endif()
  21. include (${CMAKE_ROOT}/Modules/CMakeBackwardCompatibilityCXX.cmake)
  22. if(WIN32 AND "${CMAKE_C_COMPILER_ID}" MATCHES "^(Intel)$")
  23. set(_INTEL_WINDOWS 1)
  24. endif()
  25. # Disable deprecation warnings for standard C functions.
  26. # really only needed for newer versions of VS, but should
  27. # not hurt other versions, and this will work into the
  28. # future
  29. if(MSVC OR _INTEL_WINDOWS)
  30. add_definitions(-D_CRT_SECURE_NO_DEPRECATE -D_CRT_NONSTDC_NO_DEPRECATE)
  31. else()
  32. endif()
  33. #silence duplicate symbol warnings on AIX
  34. if(CMAKE_SYSTEM MATCHES "AIX.*")
  35. if(NOT CMAKE_COMPILER_IS_GNUCXX)
  36. set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -bhalt:5 ")
  37. endif()
  38. endif()
  39. if(CMAKE_SYSTEM MATCHES "IRIX.*")
  40. if(NOT CMAKE_COMPILER_IS_GNUCXX)
  41. set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wl,-woff84 -no_auto_include")
  42. set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,-woff15")
  43. endif()
  44. endif()
  45. if(CMAKE_SYSTEM MATCHES "OSF1-V.*")
  46. if(NOT CMAKE_COMPILER_IS_GNUCXX)
  47. set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -timplicit_local -no_implicit_include ")
  48. endif()
  49. endif()
  50. # use the ansi CXX compile flag for building cmake
  51. if (CMAKE_ANSI_CXXFLAGS)
  52. set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${CMAKE_ANSI_CXXFLAGS}")
  53. endif ()
  54. if (CMAKE_ANSI_CFLAGS)
  55. set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${CMAKE_ANSI_CFLAGS}")
  56. endif ()
  57. # avoid binutils problem with large binaries, e.g. when building CMake in debug mode
  58. # See http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50230
  59. if (CMAKE_SYSTEM_NAME STREQUAL Linux AND CMAKE_SYSTEM_PROCESSOR STREQUAL parisc)
  60. set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,--unique=.text.*")
  61. endif ()