2016-09-27 22:01:08 +03:00
|
|
|
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
|
|
|
|
# file Copyright.txt or https://cmake.org/licensing for details.
|
|
|
|
|
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
|
|
|
|
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})
|
2016-07-28 01:41:13 +03:00
|
|
|
string(APPEND CMAKE_CXX_FLAGS " ${CMAKE_ANSI_CXXFLAGS}")
|
2012-08-13 21:47:32 +04:00
|
|
|
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
|
|
|
|