1 # - Check for ANSI for scope support
2 # Check if the compiler restricts the scope of variables declared in a for-init-statement to the loop body.
3 # CMAKE_NO_ANSI_FOR_SCOPE - holds result
6 #=============================================================================
7 # Copyright 2002-2009 Kitware, Inc.
9 # Distributed under the OSI-approved BSD License (the "License");
10 # see accompanying file Copyright.txt for details.
12 # This software is distributed WITHOUT ANY WARRANTY; without even the
13 # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
14 # See the License for more information.
15 #=============================================================================
16 # (To distribute this file outside of CMake, substitute the full
17 # License text for the above reference.)
19 if("CMAKE_ANSI_FOR_SCOPE" MATCHES "^CMAKE_ANSI_FOR_SCOPE$")
20 message(STATUS "Check for ANSI scope")
21 try_compile(CMAKE_ANSI_FOR_SCOPE ${CMAKE_BINARY_DIR}
22 ${CMAKE_ROOT}/Modules/TestForAnsiForScope.cxx
23 OUTPUT_VARIABLE OUTPUT)
24 if (CMAKE_ANSI_FOR_SCOPE)
25 message(STATUS "Check for ANSI scope - found")
26 set (CMAKE_NO_ANSI_FOR_SCOPE 0 CACHE INTERNAL
27 "Does the compiler support ansi for scope.")
28 file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log
29 "Determining if the CXX compiler understands ansi for scopes passed with "
30 "the following output:\n${OUTPUT}\n\n")
32 message(STATUS "Check for ANSI scope - not found")
33 set (CMAKE_NO_ANSI_FOR_SCOPE 1 CACHE INTERNAL
34 "Does the compiler support ansi for scope.")
35 file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log
36 "Determining if the CXX compiler understands ansi for scopes failed with "
37 "the following output:\n${OUTPUT}\n\n")