2005-12-15 18:41:19 +03:00
|
|
|
# - define a bunch of backwards compatibility variables
|
2012-08-13 21:42:58 +04:00
|
|
|
# CMAKE_ANSI_CXXFLAGS - flag for ansi c++
|
2005-12-14 21:51:08 +03:00
|
|
|
# CMAKE_HAS_ANSI_STRING_STREAM - has <strstream>
|
2012-08-13 21:47:32 +04:00
|
|
|
# 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 "")
|
|
|
|
if(CMAKE_SYSTEM MATCHES "IRIX.*")
|
|
|
|
set(CMAKE_TRY_ANSI_CXX_FLAGS "-LANG:std")
|
2012-08-13 21:50:14 +04:00
|
|
|
endif()
|
2012-08-13 21:47:32 +04:00
|
|
|
if(CMAKE_SYSTEM MATCHES "OSF.*")
|
|
|
|
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
|
2012-08-13 21:47:32 +04:00
|
|
|
if( CMAKE_TRY_ANSI_CXX_FLAGS MATCHES ".+")
|
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
|
|
|
|