summaryrefslogtreecommitdiffstats
path: root/Modules/CMakeDetermineCXXCompiler.cmake
diff options
context:
space:
mode:
authorBill Hoffman <bill.hoffman@kitware.com>2003-12-12 14:12:49 (GMT)
committerBill Hoffman <bill.hoffman@kitware.com>2003-12-12 14:12:49 (GMT)
commit89fe29a41a03e63e53197f61584029e987898634 (patch)
treed578b7055f18a35f1d36ebbc2e5ceb3fe3ba7385 /Modules/CMakeDetermineCXXCompiler.cmake
parent256947ed08cbcbd82bd80fa58630f272c398f6ef (diff)
downloadCMake-89fe29a41a03e63e53197f61584029e987898634.zip
CMake-89fe29a41a03e63e53197f61584029e987898634.tar.gz
CMake-89fe29a41a03e63e53197f61584029e987898634.tar.bz2
ENH: reduce the number of times gnu is tested for
Diffstat (limited to 'Modules/CMakeDetermineCXXCompiler.cmake')
-rw-r--r--Modules/CMakeDetermineCXXCompiler.cmake32
1 files changed, 17 insertions, 15 deletions
diff --git a/Modules/CMakeDetermineCXXCompiler.cmake b/Modules/CMakeDetermineCXXCompiler.cmake
index 4c94184..661f489 100644
--- a/Modules/CMakeDetermineCXXCompiler.cmake
+++ b/Modules/CMakeDetermineCXXCompiler.cmake
@@ -38,21 +38,23 @@ IF(NOT CMAKE_CXX_COMPILER)
ENDIF(NOT CMAKE_CXX_COMPILER)
MARK_AS_ADVANCED(CMAKE_CXX_COMPILER)
-
-# test to see if the cxx compiler is gnu
-EXEC_PROGRAM(${CMAKE_CXX_COMPILER} ARGS -E "\"${CMAKE_ROOT}/Modules/CMakeTestGNU.c\"" OUTPUT_VARIABLE CMAKE_COMPILER_OUTPUT RETURN_VALUE CMAKE_COMPILER_RETURN)
-IF(NOT CMAKE_COMPILER_RETURN)
- IF("${CMAKE_COMPILER_OUTPUT}" MATCHES ".*THIS_IS_GNU.*" )
- SET(CMAKE_COMPILER_IS_GNUCXX 1)
- FILE(APPEND ${CMAKE_BINARY_DIR}/CMakeOutput.log
- "Determining if the C++ compiler is GNU succeeded with "
- "the following output:\n${CMAKE_COMPILER_OUTPUT}\n\n")
- ELSE("${CMAKE_COMPILER_OUTPUT}" MATCHES ".*THIS_IS_GNU.*" )
- FILE(APPEND ${CMAKE_BINARY_DIR}/CMakeOutput.log
- "Determining if the C++ compiler is GNU failed with "
- "the following output:\n${CMAKE_COMPILER_OUTPUT}\n\n")
- ENDIF("${CMAKE_COMPILER_OUTPUT}" MATCHES ".*THIS_IS_GNU.*" )
-ENDIF(NOT CMAKE_COMPILER_RETURN)
+IF(NOT CMAKE_COMPILER_IS_GNUCXX_RUN)
+ # test to see if the cxx compiler is gnu
+ SET(CMAKE_COMPILER_IS_GNUCXX_RUN 1)
+ EXEC_PROGRAM(${CMAKE_CXX_COMPILER} ARGS -E "\"${CMAKE_ROOT}/Modules/CMakeTestGNU.c\"" OUTPUT_VARIABLE CMAKE_COMPILER_OUTPUT RETURN_VALUE CMAKE_COMPILER_RETURN)
+ IF(NOT CMAKE_COMPILER_RETURN)
+ IF("${CMAKE_COMPILER_OUTPUT}" MATCHES ".*THIS_IS_GNU.*" )
+ SET(CMAKE_COMPILER_IS_GNUCXX 1)
+ FILE(APPEND ${CMAKE_BINARY_DIR}/CMakeOutput.log
+ "Determining if the C++ compiler is GNU succeeded with "
+ "the following output:\n${CMAKE_COMPILER_OUTPUT}\n\n")
+ ELSE("${CMAKE_COMPILER_OUTPUT}" MATCHES ".*THIS_IS_GNU.*" )
+ FILE(APPEND ${CMAKE_BINARY_DIR}/CMakeOutput.log
+ "Determining if the C++ compiler is GNU failed with "
+ "the following output:\n${CMAKE_COMPILER_OUTPUT}\n\n")
+ ENDIF("${CMAKE_COMPILER_OUTPUT}" MATCHES ".*THIS_IS_GNU.*" )
+ ENDIF(NOT CMAKE_COMPILER_RETURN)
+ENDIF(NOT CMAKE_COMPILER_IS_GNUCXX_RUN)
# configure all variables set in this file
CONFIGURE_FILE(${CMAKE_ROOT}/Modules/CMakeCXXCompiler.cmake.in