ENH: fix bug where sharedforward would not work if there was a space in the path...
[cmake.git] / Modules / CMakeBackwardCompatibilityCXX.cmake
blob29dabc60e62c9576abe977ea62f2b10665b7b307
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)
8 IF(NOT CMAKE_SKIP_COMPATIBILITY_TESTS)
9   # check for some ANSI flags in the CXX compiler if it is not gnu
10   IF(NOT CMAKE_COMPILER_IS_GNUCXX)
11     INCLUDE(TestCXXAcceptsFlag)
12     SET(CMAKE_TRY_ANSI_CXX_FLAGS "")
13     IF(CMAKE_SYSTEM MATCHES "IRIX.*")
14       SET(CMAKE_TRY_ANSI_CXX_FLAGS "-LANG:std")
15     ENDIF(CMAKE_SYSTEM MATCHES "IRIX.*")
16     IF(CMAKE_SYSTEM MATCHES "OSF.*")
17       SET(CMAKE_TRY_ANSI_CXX_FLAGS "-std strict_ansi -nopure_cname")
18     ENDIF(CMAKE_SYSTEM MATCHES "OSF.*")
19     # if CMAKE_TRY_ANSI_CXX_FLAGS has something in it, see
20     # if the compiler accepts it
21     IF( CMAKE_TRY_ANSI_CXX_FLAGS MATCHES ".+")
22       CHECK_CXX_ACCEPTS_FLAG(${CMAKE_TRY_ANSI_CXX_FLAGS} CMAKE_CXX_ACCEPTS_FLAGS)
23       # if the compiler liked the flag then set CMAKE_ANSI_CXXFLAGS
24       # to the flag
25       IF(CMAKE_CXX_ACCEPTS_FLAGS)
26         SET(CMAKE_ANSI_CXXFLAGS ${CMAKE_TRY_ANSI_CXX_FLAGS} CACHE INTERNAL 
27         "What flags are required by the c++ compiler to make it ansi." )
28       ENDIF(CMAKE_CXX_ACCEPTS_FLAGS)
29     ENDIF( CMAKE_TRY_ANSI_CXX_FLAGS MATCHES ".+")
30   ENDIF(NOT CMAKE_COMPILER_IS_GNUCXX)
31   SET(CMAKE_CXX_FLAGS_SAVE ${CMAKE_CXX_FLAGS})
32   SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${CMAKE_ANSI_CXXFLAGS}")
33   INCLUDE(TestForANSIStreamHeaders)
34   INCLUDE(CheckIncludeFileCXX)
35   INCLUDE(TestForSTDNamespace)
36   INCLUDE(TestForANSIForScope)
37   INCLUDE(TestForSSTREAM)
38   SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS_SAVE}")
39 ENDIF(NOT CMAKE_SKIP_COMPATIBILITY_TESTS)