2013-10-15 19:17:36 +04:00
|
|
|
#.rst:
|
|
|
|
# CMakeBackwardCompatibilityCXX
|
|
|
|
# -----------------------------
|
|
|
|
#
|
|
|
|
# define a bunch of backwards compatibility variables
|
|
|
|
#
|
|
|
|
# ::
|
|
|
|
#
|
|
|
|
# CMAKE_ANSI_CXXFLAGS - flag for ansi c++
|
|
|
|
# CMAKE_HAS_ANSI_STRING_STREAM - has <strstream>
|
|
|
|
# include(TestForANSIStreamHeaders)
|
|
|
|
# include(CheckIncludeFileCXX)
|
|
|
|
# include(TestForSTDNamespace)
|
|
|
|
# include(TestForANSIForScope)
|
2009-09-28 19:46:51 +04:00
|
|
|
|
|
|
|
#=============================================================================
|
|
|
|
# Copyright 2002-2009 Kitware, Inc.
|
|
|
|
#
|
|
|
|
# Distributed under the OSI-approved BSD License (the "License");
|
|
|
|
# see accompanying file Copyright.txt for details.
|
|
|
|
#
|
|
|
|
# This software is distributed WITHOUT ANY WARRANTY; without even the
|
|
|
|
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
|
|
|
# See the License for more information.
|
|
|
|
#=============================================================================
|
2010-08-07 04:48:47 +04:00
|
|
|
# (To distribute this file outside of CMake, substitute the full
|
2009-09-28 19:46:51 +04:00
|
|
|
# License text for the above reference.)
|
|
|
|
|
2012-08-13 21:47:32 +04:00
|
|
|
if(NOT CMAKE_SKIP_COMPATIBILITY_TESTS)
|
2002-12-05 21:44:11 +03:00
|
|
|
# check for some ANSI flags in the CXX compiler if it is not gnu
|
2012-08-13 21:47:32 +04:00
|
|
|
if(NOT CMAKE_COMPILER_IS_GNUCXX)
|
|
|
|
include(TestCXXAcceptsFlag)
|
|
|
|
set(CMAKE_TRY_ANSI_CXX_FLAGS "")
|
2014-04-11 20:27:01 +04:00
|
|
|
if(CMAKE_SYSTEM_NAME MATCHES "IRIX")
|
2012-08-13 21:47:32 +04:00
|
|
|
set(CMAKE_TRY_ANSI_CXX_FLAGS "-LANG:std")
|
2012-08-13 21:50:14 +04:00
|
|
|
endif()
|
2014-04-11 20:27:01 +04:00
|
|
|
if(CMAKE_SYSTEM_NAME MATCHES "OSF")
|
2012-08-13 21:47:32 +04:00
|
|
|
set(CMAKE_TRY_ANSI_CXX_FLAGS "-std strict_ansi -nopure_cname")
|
2012-08-13 21:50:14 +04:00
|
|
|
endif()
|
2002-12-05 21:44:11 +03:00
|
|
|
# if CMAKE_TRY_ANSI_CXX_FLAGS has something in it, see
|
|
|
|
# if the compiler accepts it
|
2014-04-11 20:36:08 +04:00
|
|
|
if(NOT CMAKE_TRY_ANSI_CXX_FLAGS STREQUAL "")
|
2002-12-05 21:44:11 +03:00
|
|
|
CHECK_CXX_ACCEPTS_FLAG(${CMAKE_TRY_ANSI_CXX_FLAGS} CMAKE_CXX_ACCEPTS_FLAGS)
|
|
|
|
# if the compiler liked the flag then set CMAKE_ANSI_CXXFLAGS
|
|
|
|
# to the flag
|
2012-08-13 21:47:32 +04:00
|
|
|
if(CMAKE_CXX_ACCEPTS_FLAGS)
|
|
|
|
set(CMAKE_ANSI_CXXFLAGS ${CMAKE_TRY_ANSI_CXX_FLAGS} CACHE INTERNAL
|
2002-12-05 21:44:11 +03:00
|
|
|
"What flags are required by the c++ compiler to make it ansi." )
|
2012-08-13 21:50:14 +04:00
|
|
|
endif()
|
|
|
|
endif()
|
|
|
|
endif()
|
2012-08-13 21:47:32 +04:00
|
|
|
set(CMAKE_CXX_FLAGS_SAVE ${CMAKE_CXX_FLAGS})
|
|
|
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${CMAKE_ANSI_CXXFLAGS}")
|
|
|
|
include(TestForANSIStreamHeaders)
|
|
|
|
include(CheckIncludeFileCXX)
|
|
|
|
include(TestForSTDNamespace)
|
|
|
|
include(TestForANSIForScope)
|
|
|
|
include(TestForSSTREAM)
|
|
|
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS_SAVE}")
|
2012-08-13 21:50:14 +04:00
|
|
|
endif()
|
2006-01-17 18:21:45 +03:00
|
|
|
|