1 # - define a bunch of backwards compatibility variables
2 # CMAKE_ANSI_CXXFLAGS - flag for ansi c++
3 # CMAKE_HAS_ANSI_STRING_STREAM - has <strstream>
4 # include(TestForANSIStreamHeaders)
5 # include(CheckIncludeFileCXX)
6 # include(TestForSTDNamespace)
7 # include(TestForANSIForScope)
9 #=============================================================================
10 # Copyright 2002-2009 Kitware, Inc.
12 # Distributed under the OSI-approved BSD License (the "License");
13 # see accompanying file Copyright.txt for details.
15 # This software is distributed WITHOUT ANY WARRANTY; without even the
16 # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
17 # See the License for more information.
18 #=============================================================================
19 # (To distribute this file outside of CMake, substitute the full
20 # License text for the above reference.)
22 if(NOT CMAKE_SKIP_COMPATIBILITY_TESTS)
23 # check for some ANSI flags in the CXX compiler if it is not gnu
24 if(NOT CMAKE_COMPILER_IS_GNUCXX)
25 include(TestCXXAcceptsFlag)
26 set(CMAKE_TRY_ANSI_CXX_FLAGS "")
27 if(CMAKE_SYSTEM MATCHES "IRIX.*")
28 set(CMAKE_TRY_ANSI_CXX_FLAGS "-LANG:std")
30 if(CMAKE_SYSTEM MATCHES "OSF.*")
31 set(CMAKE_TRY_ANSI_CXX_FLAGS "-std strict_ansi -nopure_cname")
33 # if CMAKE_TRY_ANSI_CXX_FLAGS has something in it, see
34 # if the compiler accepts it
35 if( CMAKE_TRY_ANSI_CXX_FLAGS MATCHES ".+")
36 CHECK_CXX_ACCEPTS_FLAG(${CMAKE_TRY_ANSI_CXX_FLAGS} CMAKE_CXX_ACCEPTS_FLAGS)
37 # if the compiler liked the flag then set CMAKE_ANSI_CXXFLAGS
39 if(CMAKE_CXX_ACCEPTS_FLAGS)
40 set(CMAKE_ANSI_CXXFLAGS ${CMAKE_TRY_ANSI_CXX_FLAGS} CACHE INTERNAL
41 "What flags are required by the c++ compiler to make it ansi." )
45 set(CMAKE_CXX_FLAGS_SAVE ${CMAKE_CXX_FLAGS})
46 set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${CMAKE_ANSI_CXXFLAGS}")
47 include(TestForANSIStreamHeaders)
48 include(CheckIncludeFileCXX)
49 include(TestForSTDNamespace)
50 include(TestForANSIForScope)
51 include(TestForSSTREAM)
52 set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS_SAVE}")