CMakeBackwardCompatibilityCXX.cmake 1.5 KB

12345678910111213141516171819202122232425262728293031323334
  1. #
  2. # check for some ANSI flags in the CXX compiler if it is not gnu
  3. IF(NOT CMAKE_COMPILER_IS_GNUCXX)
  4. INCLUDE(${CMAKE_ROOT}/Modules/TestCXXAcceptsFlag.cmake)
  5. SET(CMAKE_TRY_ANSI_CXX_FLAGS "")
  6. IF(CMAKE_SYSTEM MATCHES "IRIX.*")
  7. SET(CMAKE_TRY_ANSI_CXX_FLAGS "-LANG:std")
  8. ENDIF(CMAKE_SYSTEM MATCHES "IRIX.*")
  9. IF(CMAKE_SYSTEM MATCHES "OSF.*")
  10. SET(CMAKE_TRY_ANSI_CXX_FLAGS "-std strict_ansi -nopure_cname")
  11. ENDIF(CMAKE_SYSTEM MATCHES "OSF.*")
  12. # if CMAKE_TRY_ANSI_CXX_FLAGS has something in it, see
  13. # if the compiler accepts it
  14. IF( CMAKE_TRY_ANSI_CXX_FLAGS MATCHES ".+")
  15. CHECK_CXX_ACCEPTS_FLAG(${CMAKE_TRY_ANSI_CXX_FLAGS} CMAKE_CXX_ACCEPTS_FLAGS)
  16. # if the compiler liked the flag then set CMAKE_ANSI_CXXFLAGS
  17. # to the flag
  18. IF(CMAKE_CXX_ACCEPTS_FLAGS)
  19. SET(CMAKE_ANSI_CXXFLAGS ${CMAKE_TRY_ANSI_CXX_FLAGS} CACHE INTERNAL
  20. "What flags are required by the c++ compiler to make it ansi." )
  21. ENDIF(CMAKE_CXX_ACCEPTS_FLAGS)
  22. ENDIF( CMAKE_TRY_ANSI_CXX_FLAGS MATCHES ".+")
  23. ENDIF(NOT CMAKE_COMPILER_IS_GNUCXX)
  24. INCLUDE(${CMAKE_ROOT}/Modules/TestForANSIStreamHeaders.cmake)
  25. INCLUDE(${CMAKE_ROOT}/Modules/CheckIncludeFileCXX.cmake)
  26. INCLUDE(${CMAKE_ROOT}/Modules/TestForSTDNamespace.cmake)
  27. INCLUDE(${CMAKE_ROOT}/Modules/TestForANSIForScope.cmake)
  28. CHECK_INCLUDE_FILE_CXX("sstream" CMAKE_HAS_ANSI_STRING_STREAM)
  29. IF(NOT CMAKE_HAS_ANSI_STRING_STREAM)
  30. SET( CMAKE_NO_ANSI_STRING_STREAM 1 CACHE INTERNAL
  31. "Does the compiler support sstream or stringstream.")
  32. ENDIF(NOT CMAKE_HAS_ANSI_STRING_STREAM)