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