summaryrefslogtreecommitdiffstats
path: root/Modules/CMakeDetermineCCompiler.cmake
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2007-04-28 13:35:01 (GMT)
committerBrad King <brad.king@kitware.com>2007-04-28 13:35:01 (GMT)
commiteac71647ddab0eb52fe3ab20062519f7693ce44d (patch)
tree865fa99dea2700f89530783c6114b5ec64fc8490 /Modules/CMakeDetermineCCompiler.cmake
parentbceb1532c665bac669f53a0f364dad920058017e (diff)
downloadCMake-eac71647ddab0eb52fe3ab20062519f7693ce44d.zip
CMake-eac71647ddab0eb52fe3ab20062519f7693ce44d.tar.gz
CMake-eac71647ddab0eb52fe3ab20062519f7693ce44d.tar.bz2
ENH: Merging CompilerId implementation from branch CMake-Modules-CompilerId to the main tree. Changes between CMake-Modules-CompilerId-bp and CMake-Modules-CompilerId-mp1 are included.
Diffstat (limited to 'Modules/CMakeDetermineCCompiler.cmake')
-rw-r--r--Modules/CMakeDetermineCCompiler.cmake55
1 files changed, 23 insertions, 32 deletions
diff --git a/Modules/CMakeDetermineCCompiler.cmake b/Modules/CMakeDetermineCCompiler.cmake
index c085947..eb79148 100644
--- a/Modules/CMakeDetermineCCompiler.cmake
+++ b/Modules/CMakeDetermineCCompiler.cmake
@@ -53,42 +53,33 @@ IF(NOT CMAKE_RANLIB)
ENDIF(NOT CMAKE_RANLIB)
MARK_AS_ADVANCED(CMAKE_RANLIB)
-# do not test for GNU if the generator is visual studio
+# Build a small source file to identify the compiler.
IF(${CMAKE_GENERATOR} MATCHES "Visual Studio")
- SET(CMAKE_COMPILER_IS_GNUCC_RUN 1)
-ENDIF(${CMAKE_GENERATOR} MATCHES "Visual Studio")
+ SET(CMAKE_C_COMPILER_ID_RUN 1)
+ SET(CMAKE_C_PLATFORM_ID "Windows")
+ # TODO: Set the compiler id. It is probably MSVC but
+ # the user may be using an integrated Intel compiler.
+ # SET(CMAKE_C_COMPILER_ID "MSVC")
+ENDIF(${CMAKE_GENERATOR} MATCHES "Visual Studio")
+IF(NOT CMAKE_C_COMPILER_ID_RUN)
+ SET(CMAKE_C_COMPILER_ID_RUN 1)
-IF(NOT CMAKE_COMPILER_IS_GNUCC_RUN)
- # test to see if the c compiler is gnu
-
- IF(CMAKE_C_FLAGS)
- SET(CMAKE_BOOT_C_FLAGS ${CMAKE_C_FLAGS})
- ELSE(CMAKE_C_FLAGS)
- SET(CMAKE_BOOT_C_FLAGS $ENV{CFLAGS})
- ENDIF(CMAKE_C_FLAGS)
- EXEC_PROGRAM(${CMAKE_C_COMPILER} ARGS ${CMAKE_BOOT_C_FLAGS} -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}${CMAKE_FILES_DIRECTORY}/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}${CMAKE_FILES_DIRECTORY}/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)
+ # Try to identify the compiler.
+ SET(CMAKE_C_COMPILER_ID)
+ INCLUDE(${CMAKE_ROOT}/Modules/CMakeDetermineCompilerId.cmake)
+ CMAKE_DETERMINE_COMPILER_ID(C ${CMAKE_ROOT}/Modules/CMakeCCompilerId.c)
+ # Set old compiler and platform id variables.
+ IF("${CMAKE_C_COMPILER_ID}" MATCHES "GNU")
+ SET(CMAKE_COMPILER_IS_GNUCC 1)
+ ENDIF("${CMAKE_C_COMPILER_ID}" MATCHES "GNU")
+ IF("${CMAKE_C_PLATFORM_ID}" MATCHES "MinGW")
+ SET(CMAKE_COMPILER_IS_MINGW 1)
+ ELSEIF("${CMAKE_C_PLATFORM_ID}" MATCHES "Cygwin")
+ SET(CMAKE_COMPILER_IS_CYGWIN 1)
+ ENDIF("${CMAKE_C_PLATFORM_ID}" MATCHES "MinGW")
+ENDIF(NOT CMAKE_C_COMPILER_ID_RUN)
# configure variables set in this file for fast reload later on
CONFIGURE_FILE(${CMAKE_ROOT}/Modules/CMakeCCompiler.cmake.in