2016-09-27 19:01:08 +00:00
|
|
|
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
|
|
|
|
# file Copyright.txt or https://cmake.org/licensing for details.
|
|
|
|
|
2018-10-22 14:31:08 +00: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 15:46:51 +00:00
|
|
|
|
2012-08-13 17:47:32 +00:00
|
|
|
if(NOT CMAKE_SKIP_COMPATIBILITY_TESTS)
|
2002-12-05 18:44:11 +00:00
|
|
|
# check for some ANSI flags in the CXX compiler if it is not gnu
|
2012-08-13 17:47:32 +00:00
|
|
|
if(NOT CMAKE_COMPILER_IS_GNUCXX)
|
|
|
|
include(TestCXXAcceptsFlag)
|
|
|
|
set(CMAKE_TRY_ANSI_CXX_FLAGS "")
|
2014-04-11 16:27:01 +00:00
|
|
|
if(CMAKE_SYSTEM_NAME MATCHES "OSF")
|
2012-08-13 17:47:32 +00:00
|
|
|
set(CMAKE_TRY_ANSI_CXX_FLAGS "-std strict_ansi -nopure_cname")
|
2012-08-13 17:50:14 +00:00
|
|
|
endif()
|
2002-12-05 18:44:11 +00:00
|
|
|
# if CMAKE_TRY_ANSI_CXX_FLAGS has something in it, see
|
|
|
|
# if the compiler accepts it
|
2014-04-11 16:36:08 +00:00
|
|
|
if(NOT CMAKE_TRY_ANSI_CXX_FLAGS STREQUAL "")
|
2002-12-05 18:44:11 +00: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 17:47:32 +00:00
|
|
|
if(CMAKE_CXX_ACCEPTS_FLAGS)
|
|
|
|
set(CMAKE_ANSI_CXXFLAGS ${CMAKE_TRY_ANSI_CXX_FLAGS} CACHE INTERNAL
|
2002-12-05 18:44:11 +00:00
|
|
|
"What flags are required by the c++ compiler to make it ansi." )
|
2012-08-13 17:50:14 +00:00
|
|
|
endif()
|
|
|
|
endif()
|
|
|
|
endif()
|
2012-08-13 17:47:32 +00:00
|
|
|
set(CMAKE_CXX_FLAGS_SAVE ${CMAKE_CXX_FLAGS})
|
2016-07-27 22:41:13 +00:00
|
|
|
string(APPEND CMAKE_CXX_FLAGS " ${CMAKE_ANSI_CXXFLAGS}")
|
2012-08-13 17:47:32 +00:00
|
|
|
include(TestForANSIStreamHeaders)
|
|
|
|
include(CheckIncludeFileCXX)
|
|
|
|
include(TestForSTDNamespace)
|
|
|
|
include(TestForANSIForScope)
|
|
|
|
include(TestForSSTREAM)
|
|
|
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS_SAVE}")
|
2012-08-13 17:50:14 +00:00
|
|
|
endif()
|
2006-01-17 15:21:45 +00:00
|
|
|
|