From 89fe29a41a03e63e53197f61584029e987898634 Mon Sep 17 00:00:00 2001 From: Bill Hoffman Date: Fri, 12 Dec 2003 09:12:49 -0500 Subject: ENH: reduce the number of times gnu is tested for --- Modules/CMakeCCompiler.cmake.in | 2 +- Modules/CMakeCXXCompiler.cmake.in | 1 + Modules/CMakeDetermineCCompiler.cmake | 44 +++++++++++++++++---------------- Modules/CMakeDetermineCXXCompiler.cmake | 32 +++++++++++++----------- 4 files changed, 42 insertions(+), 37 deletions(-) diff --git a/Modules/CMakeCCompiler.cmake.in b/Modules/CMakeCCompiler.cmake.in index c9d5008..ad748ee 100644 --- a/Modules/CMakeCCompiler.cmake.in +++ b/Modules/CMakeCCompiler.cmake.in @@ -13,4 +13,4 @@ ENDIF(CMAKE_COMPILER_IS_CYGWIN) IF(CMAKE_COMPILER_IS_MINGW) SET(MINGW 1) ENDIF(CMAKE_COMPILER_IS_MINGW) - +SET(CMAKE_COMPILER_IS_GNUCC_RUN 1) diff --git a/Modules/CMakeCXXCompiler.cmake.in b/Modules/CMakeCXXCompiler.cmake.in index 6dcba48..4324b98 100644 --- a/Modules/CMakeCXXCompiler.cmake.in +++ b/Modules/CMakeCXXCompiler.cmake.in @@ -1,4 +1,5 @@ SET(CMAKE_CXX_COMPILER "@CMAKE_CXX_COMPILER@") SET(CMAKE_COMPILER_IS_GNUCXX @CMAKE_COMPILER_IS_GNUCXX@) SET(CMAKE_CXX_COMPILER_LOADED 1) +SET(CMAKE_COMPILER_IS_GNUCC_RUN 1) diff --git a/Modules/CMakeDetermineCCompiler.cmake b/Modules/CMakeDetermineCCompiler.cmake index 573dd73..e8cc39e 100644 --- a/Modules/CMakeDetermineCCompiler.cmake +++ b/Modules/CMakeDetermineCCompiler.cmake @@ -46,27 +46,29 @@ IF(NOT CMAKE_RANLIB) ENDIF(NOT CMAKE_RANLIB) MARK_AS_ADVANCED(CMAKE_RANLIB) -# test to see if the c compiler is gnu -EXEC_PROGRAM(${CMAKE_C_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_GNUCC 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.*" ) - IF("${CMAKE_COMPILER_OUTPUT}" MATCHES ".*THIS_IS_MINGW.*" ) - SET(CMAKE_COMPILER_IS_MINGW 1) - ENDIF("${CMAKE_COMPILER_OUTPUT}" MATCHES ".*THIS_IS_MINGW.*" ) - IF("${CMAKE_COMPILER_OUTPUT}" MATCHES ".*THIS_IS_CYGWIN.*" ) - SET(CMAKE_COMPILER_IS_CYGWIN 1) - ENDIF("${CMAKE_COMPILER_OUTPUT}" MATCHES ".*THIS_IS_CYGWIN.*" ) - -ENDIF(NOT CMAKE_COMPILER_RETURN) +IF(NOT CMAKE_COMPILER_IS_GNUCC_RUN) + # test to see if the c compiler is gnu + EXEC_PROGRAM(${CMAKE_C_COMPILER} ARGS -E "\"${CMAKE_ROOT}/Modules/CMakeTestGNU.c\"" OUTPUT_VARIABLE CMAKE_COMPILER_OUTPUT RETURN_VALUE CMAKE_COMPILER_RETURN) + SET(CMAKE_COMPILER_IS_GNUCC_RUN 1) + IF(NOT CMAKE_COMPILER_RETURN) + IF("${CMAKE_COMPILER_OUTPUT}" MATCHES ".*THIS_IS_GNU.*" ) + SET(CMAKE_COMPILER_IS_GNUCC 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.*" ) + IF("${CMAKE_COMPILER_OUTPUT}" MATCHES ".*THIS_IS_MINGW.*" ) + SET(CMAKE_COMPILER_IS_MINGW 1) + ENDIF("${CMAKE_COMPILER_OUTPUT}" MATCHES ".*THIS_IS_MINGW.*" ) + IF("${CMAKE_COMPILER_OUTPUT}" MATCHES ".*THIS_IS_CYGWIN.*" ) + SET(CMAKE_COMPILER_IS_CYGWIN 1) + ENDIF("${CMAKE_COMPILER_OUTPUT}" MATCHES ".*THIS_IS_CYGWIN.*" ) + ENDIF(NOT CMAKE_COMPILER_RETURN) +ENDIF(NOT CMAKE_COMPILER_IS_GNUCC_RUN) # configure variables set in this file for fast reload later on 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 -- cgit v0.12