[cmake-commits] king committed CMakeCCompiler.cmake.in 1.13 1.13.4.1
CMakeCCompilerId.c NONE 1.1.2.1 CMakeCXXCompiler.cmake.in 1.12
1.12.4.1 CMakeCXXCompilerId.cpp NONE 1.1.2.1
CMakeDetermineCCompiler.cmake 1.38 1.38.2.1
CMakeDetermineCXXCompiler.cmake 1.33 1.33.2.1
CMakeDetermineCompilerId.cmake NONE 1.1.2.1 CMakePlatformId.h
NONE 1.1.2.1
cmake-commits at cmake.org
cmake-commits at cmake.org
Fri Apr 27 08:57:40 EDT 2007
Update of /cvsroot/CMake/CMake/Modules
In directory public:/mounts/ram/cvs-serv30164
Modified Files:
Tag: CMake-Modules-CompilerId
CMakeCCompiler.cmake.in CMakeCXXCompiler.cmake.in
CMakeDetermineCCompiler.cmake CMakeDetermineCXXCompiler.cmake
Added Files:
Tag: CMake-Modules-CompilerId
CMakeCCompilerId.c CMakeCXXCompilerId.cpp
CMakeDetermineCompilerId.cmake CMakePlatformId.h
Log Message:
ENH: Initial checkin of CompilerId feature on CMake-Modules-CompilerId branch. This helps identify compilers and platforms by actually building a source file and using the preprocessor definitions to recognize known compilers.
Index: CMakeDetermineCXXCompiler.cmake
===================================================================
RCS file: /cvsroot/CMake/CMake/Modules/CMakeDetermineCXXCompiler.cmake,v
retrieving revision 1.33
retrieving revision 1.33.2.1
diff -u -d -r1.33 -r1.33.2.1
--- CMakeDetermineCXXCompiler.cmake 25 Apr 2007 20:22:46 -0000 1.33
+++ CMakeDetermineCXXCompiler.cmake 27 Apr 2007 12:57:38 -0000 1.33.2.1
@@ -61,42 +61,40 @@
ENDIF(NOT CMAKE_RANLIB)
MARK_AS_ADVANCED(CMAKE_RANLIB)
-# do not test for GNU if the generator is visual studio
-IF(${CMAKE_GENERATOR} MATCHES "Visual Studio")
- SET(CMAKE_COMPILER_IS_GNUCXX_RUN 1)
-ENDIF(${CMAKE_GENERATOR} MATCHES "Visual Studio")
-
+# This block was used before the compiler was identified by building a
+# source file. Unless g++ crashes when building a small C++
+# executable this should no longer be needed.
+#
# The g++ that comes with BeOS 5 segfaults if you run "g++ -E"
# ("gcc -E" is fine), which throws up a system dialog box that hangs cmake
# until the user clicks "OK"...so for now, we just assume it's g++.
-IF(BEOS)
- SET(CMAKE_COMPILER_IS_GNUCXX 1)
- SET(CMAKE_COMPILER_IS_GNUCXX_RUN 1)
-ENDIF(BEOS)
+# IF(BEOS)
+# SET(CMAKE_COMPILER_IS_GNUCXX 1)
+# SET(CMAKE_COMPILER_IS_GNUCXX_RUN 1)
+# ENDIF(BEOS)
-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}${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_GNUCXX_RUN)
+# Build a small source file to identify the compiler.
+IF(${CMAKE_GENERATOR} MATCHES "(Visual Studio|Xcode)")
+ SET(CMAKE_CXX_COMPILER_ID_RUN 1)
+ENDIF(${CMAKE_GENERATOR} MATCHES "(Visual Studio|Xcode)")
+IF(NOT CMAKE_CXX_COMPILER_ID_RUN)
+ SET(CMAKE_CXX_COMPILER_ID_RUN 1)
+
+ # Try to identify the compiler.
+ SET(CMAKE_CXX_COMPILER_ID)
+ INCLUDE(${CMAKE_ROOT}/Modules/CMakeDetermineCompilerId.cmake)
+ CMAKE_DETERMINE_COMPILER_ID(CXX ${CMAKE_ROOT}/Modules/CMakeCXXCompilerId.cpp)
+
+ # Set old compiler and platform id variables.
+ IF("${CMAKE_CXX_COMPILER_ID}" MATCHES "GNU")
+ SET(CMAKE_COMPILER_IS_GNUCXX 1)
+ ENDIF("${CMAKE_CXX_COMPILER_ID}" MATCHES "GNU")
+ IF("${CMAKE_CXX_PLATFORM_ID}" MATCHES "MinGW")
+ SET(CMAKE_COMPILER_IS_MINGW 1)
+ ELSEIF("${CMAKE_CXX_PLATFORM_ID}" MATCHES "Cygwin")
+ SET(CMAKE_COMPILER_IS_CYGWIN 1)
+ ENDIF("${CMAKE_CXX_PLATFORM_ID}" MATCHES "MinGW")
+ENDIF(NOT CMAKE_CXX_COMPILER_ID_RUN)
# configure all variables set in this file
CONFIGURE_FILE(${CMAKE_ROOT}/Modules/CMakeCXXCompiler.cmake.in
Index: CMakeCXXCompiler.cmake.in
===================================================================
RCS file: /cvsroot/CMake/CMake/Modules/CMakeCXXCompiler.cmake.in,v
retrieving revision 1.12
retrieving revision 1.12.4.1
diff -u -d -r1.12 -r1.12.4.1
--- CMakeCXXCompiler.cmake.in 9 Feb 2006 18:48:09 -0000 1.12
+++ CMakeCXXCompiler.cmake.in 27 Apr 2007 12:57:38 -0000 1.12.4.1
@@ -1,5 +1,7 @@
SET(CMAKE_CXX_COMPILER "@CMAKE_CXX_COMPILER@")
SET(CMAKE_CXX_COMPILER_ARG1 "@CMAKE_CXX_COMPILER_ARG1@")
+SET(CMAKE_CXX_COMPILER_ID "@CMAKE_CXX_COMPILER_ID@")
+SET(CMAKE_CXX_PLATFORM_ID "@CMAKE_CXX_PLATFORM_ID@")
SET(CMAKE_AR "@CMAKE_AR@")
SET(CMAKE_RANLIB "@CMAKE_RANLIB@")
SET(CMAKE_COMPILER_IS_GNUCXX @CMAKE_COMPILER_IS_GNUCXX@)
@@ -16,7 +18,7 @@
IF(CMAKE_COMPILER_IS_MINGW)
SET(MINGW 1)
ENDIF(CMAKE_COMPILER_IS_MINGW)
-SET(CMAKE_COMPILER_IS_GNUCXX_RUN 1)
+SET(CMAKE_CXX_COMPILER_ID_RUN 1)
SET(CMAKE_CXX_IGNORE_EXTENSIONS inl;h;H;o;O;obj;OBJ;def;DEF;rc;RC)
SET(CMAKE_CXX_SOURCE_FILE_EXTENSIONS C;M;c++;cc;cpp;cxx;m;mm)
SET(CMAKE_CXX_LINKER_PREFERENCE Prefered)
Index: CMakeCCompiler.cmake.in
===================================================================
RCS file: /cvsroot/CMake/CMake/Modules/CMakeCCompiler.cmake.in,v
retrieving revision 1.13
retrieving revision 1.13.4.1
diff -u -d -r1.13 -r1.13.4.1
--- CMakeCCompiler.cmake.in 25 Jan 2006 16:41:05 -0000 1.13
+++ CMakeCCompiler.cmake.in 27 Apr 2007 12:57:38 -0000 1.13.4.1
@@ -1,5 +1,7 @@
SET(CMAKE_C_COMPILER "@CMAKE_C_COMPILER@")
SET(CMAKE_C_COMPILER_ARG1 "@CMAKE_C_COMPILER_ARG1@")
+SET(CMAKE_C_COMPILER_ID "@CMAKE_C_COMPILER_ID@")
+SET(CMAKE_C_PLATFORM_ID "@CMAKE_C_PLATFORM_ID@")
SET(CMAKE_AR "@CMAKE_AR@")
SET(CMAKE_RANLIB "@CMAKE_RANLIB@")
SET(CMAKE_COMPILER_IS_GNUCC @CMAKE_COMPILER_IS_GNUCC@)
@@ -16,7 +18,7 @@
IF(CMAKE_COMPILER_IS_MINGW)
SET(MINGW 1)
ENDIF(CMAKE_COMPILER_IS_MINGW)
-SET(CMAKE_COMPILER_IS_GNUCC_RUN 1)
+SET(CMAKE_C_COMPILER_ID_RUN 1)
SET(CMAKE_C_SOURCE_FILE_EXTENSIONS c)
SET(CMAKE_C_IGNORE_EXTENSIONS h;H;o;O;obj;OBJ;def;DEF;rc;RC)
SET(CMAKE_C_LINKER_PREFERENCE None)
--- NEW FILE: CMakeDetermineCompilerId.cmake ---
# Macro to compile a source file to identify the compiler. This is
# used internally by CMake and should not be included by user code.
MACRO(CMAKE_DETERMINE_COMPILER_ID lang src)
# Store the compiler identification source file.
SET(CMAKE_${lang}_COMPILER_ID_SRC "${src}")
# Make sure user-specified compiler flags are used.
IF(CMAKE_${lang}_FLAGS)
SET(CMAKE_${lang}_COMPILER_ID_FLAGS ${CMAKE_${lang}_FLAGS})
ELSE(CMAKE_${lang}_FLAGS)
SET(CMAKE_${lang}_COMPILER_ID_FLAGS $ENV{${lang}FLAGS})
ENDIF(CMAKE_${lang}_FLAGS)
# Create an empty directory in which to run the test.
SET(CMAKE_${lang}_COMPILER_ID_DIR ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CompilerId${lang})
FILE(REMOVE_RECURSE ${CMAKE_${lang}_COMPILER_ID_DIR})
FILE(MAKE_DIRECTORY ${CMAKE_${lang}_COMPILER_ID_DIR})
# Compile the compiler identification source.
STRING(REGEX REPLACE " " ";" CMAKE_${lang}_COMPILER_ID_FLAGS_LIST "${CMAKE_${lang}_COMPILER_ID_FLAGS}")
IF(COMMAND EXECUTE_PROCESS)
EXECUTE_PROCESS(
COMMAND ${CMAKE_${lang}_COMPILER} ${CMAKE_${lang}_COMPILER_ID_FLAGS_LIST} ${CMAKE_${lang}_COMPILER_ID_SRC}
WORKING_DIRECTORY ${CMAKE_${lang}_COMPILER_ID_DIR}
OUTPUT_VARIABLE CMAKE_${lang}_COMPILER_ID_OUTPUT
ERROR_VARIABLE CMAKE_${lang}_COMPILER_ID_OUTPUT
RESULT_VARIABLE CMAKE_${lang}_COMPILER_ID_RESULT
)
ELSE(COMMAND EXECUTE_PROCESS)
EXEC_PROGRAM(
${CMAKE_${lang}_COMPILER} ${CMAKE_${lang}_COMPILER_ID_DIR}
ARGS ${CMAKE_${lang}_COMPILER_ID_FLAGS_LIST} \"${CMAKE_${lang}_COMPILER_ID_SRC}\"
OUTPUT_VARIABLE CMAKE_${lang}_COMPILER_ID_OUTPUT
RETURN_VALUE CMAKE_${lang}_COMPILER_ID_RESULT
)
ENDIF(COMMAND EXECUTE_PROCESS)
# Check the result of compilation.
IF(CMAKE_${lang}_COMPILER_ID_RESULT)
# Compilation failed.
FILE(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log
"Compiling the ${lang} compiler identification source file \""
"${CMAKE_${lang}_COMPILER_ID_SRC}\" failed with the following output:\n"
"${CMAKE_${lang}_COMPILER_ID_RESULT}\n"
"${CMAKE_${lang}_COMPILER_ID_OUTPUT}\n\n")
ELSE(CMAKE_${lang}_COMPILER_ID_RESULT)
# Compilation succeeded.
FILE(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log
"Compiling the ${lang} compiler identification source file \""
"${CMAKE_${lang}_COMPILER_ID_SRC}\" succeeded with the following output:\n"
"${CMAKE_${lang}_COMPILER_ID_OUTPUT}\n\n")
# Find the executable produced by the compiler.
SET(CMAKE_${lang}_COMPILER_ID_EXE)
GET_FILENAME_COMPONENT(CMAKE_${lang}_COMPILER_ID_SRC_BASE ${CMAKE_${lang}_COMPILER_ID_SRC} NAME_WE)
FOREACH(name a.out a.exe ${CMAKE_${lang}_COMPILER_ID_SRC_BASE}.exe)
IF(EXISTS ${CMAKE_${lang}_COMPILER_ID_DIR}/${name})
SET(CMAKE_${lang}_COMPILER_ID_EXE ${CMAKE_${lang}_COMPILER_ID_DIR}/${name})
ENDIF(EXISTS ${CMAKE_${lang}_COMPILER_ID_DIR}/${name})
ENDFOREACH(name)
# Check if the executable was found.
IF(CMAKE_${lang}_COMPILER_ID_EXE)
# The executable was found.
FILE(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log
"Compilation of the ${lang} compiler identification source \""
"${CMAKE_${lang}_COMPILER_ID_SRC}\" produced \""
"${CMAKE_${lang}_COMPILER_ID_EXE}\"\n\n")
# Read the compiler identification string from the executable file.
FILE(STRINGS ${CMAKE_${lang}_COMPILER_ID_EXE}
CMAKE_${lang}_COMPILER_ID_STRINGS LIMIT_COUNT 2 REGEX "INFO:")
FOREACH(info ${CMAKE_${lang}_COMPILER_ID_STRINGS})
IF("${info}" MATCHES "INFO:compiler\\[(.*)\\]")
STRING(REGEX REPLACE "INFO:compiler\\[(.*)\\]" "\\1"
CMAKE_${lang}_COMPILER_ID "${info}")
ELSEIF("${info}" MATCHES "INFO:platform\\[(.*)\\]")
STRING(REGEX REPLACE "INFO:platform\\[(.*)\\]" "\\1"
CMAKE_${lang}_PLATFORM_ID "${info}")
ENDIF("${info}" MATCHES "INFO:compiler\\[(.*)\\]")
ENDFOREACH(info)
# Check the compiler identification string.
IF(CMAKE_${lang}_COMPILER_ID)
# The compiler identification was found.
FILE(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log
"The ${lang} compiler identification is ${CMAKE_${lang}_COMPILER_ID}\n\n")
ELSE(CMAKE_${lang}_COMPILER_ID)
# The compiler identification could not be found.
FILE(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log
"The ${lang} compiler identification could not be found in \""
"${CMAKE_${lang}_COMPILER_ID_EXE}\"\n\n")
ENDIF(CMAKE_${lang}_COMPILER_ID)
ELSE(CMAKE_${lang}_COMPILER_ID_EXE)
# The executable was not found.
FILE(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log
"Compilation of the ${lang} compiler identification source \""
"${CMAKE_${lang}_COMPILER_ID_SRC}\" did not produce an executable in "
"${CMAKE_${lang}_COMPILER_ID_DIR} "
"with a name known to CMake.\n\n")
ENDIF(CMAKE_${lang}_COMPILER_ID_EXE)
ENDIF(CMAKE_${lang}_COMPILER_ID_RESULT)
ENDMACRO(CMAKE_DETERMINE_COMPILER_ID)
--- NEW FILE: CMakeCXXCompilerId.cpp ---
#ifndef __cplusplus
# error "A C compiler has been selected for C++."
#endif
static char const info_compiler[] = "INFO:compiler["
#if defined(__COMO__)
"Comeau"
#elif defined(__INTEL_COMPILER) || defined(__ICC)
"Intel"
#elif defined(__BORLANDC__)
"Borland"
#elif defined(__SUNPRO_CC)
"SunPro"
#elif defined(__HP_aCC)
"HP"
#elif defined(__DECCXX)
"Compaq"
#elif defined(__IBMCPP__)
"VisualAge"
#elif defined(__GNUC__)
"GNUC"
#elif defined(_MSC_VER)
"MSVC"
#elif defined(_COMPILER_VERSION)
"MIPSpro"
/* This compiler is either not known or is too old to define an
identification macro. Try to identify the platform and guess that
it is the native compiler. */
#elif defined(__sgi)
"MIPSpro"
#elif defined(__hpua) || defined(__hppx)
"HP"
#else /* unknown compiler */
""
#endif
"]";
/* Include the platform identification source. */
#include "CMakePlatformId.h"
/* Make sure the information strings are referenced. */
int main()
{
return ((int)&info_compiler) + ((int)&info_platform);
}
--- NEW FILE: CMakePlatformId.h ---
/* Identify known platforms by name. */
static char const info_platform[] = "INFO:platform["
#if defined(__linux) || defined(__linux__) || defined(linux)
"Linux"
#elif defined(__CYGWIN__)
"Cygwin"
#elif defined(__MINGW32__)
"MinGW"
#elif defined(__APPLE__)
"Darwin"
#elif defined(_WIN32) || defined(__WIN32__) || defined(WIN32)
"Windows"
#elif defined(__FreeBSD__) || defined(__FreeBSD)
"FreeBSD"
#elif defined(__NetBSD__) || defined(__NetBSD)
"NetBSD"
#elif defined(__OpenBSD__) || defined(__OPENBSD)
"OpenBSD"
#elif defined(__sun) || defined(sun)
"SunOS"
#elif defined(_AIX) || defined(__AIX) || defined(__AIX__) || defined(__aix) || defined(__aix__)
"AIX"
#elif defined(__sgi) || defined(__sgi__) || defined(_SGI)
"IRIX"
#elif defined(__hpux) || defined(__hpux__)
"HP-UX"
#elif defined(__BeOS) || defined(__BEOS__) || defined(_BEOS)
"BeOS"
#elif defined(__QNX__) || defined(__QNXNTO__)
"QNX"
#elif defined(__tru64) || defined(_tru64) || defined(__TRU64__)
"Tru64"
#elif defined(__riscos) || defined(__riscos__)
"RISCos"
#elif defined(__sinix) || defined(__sinix__) || defined(__SINIX__)
"SINIX"
#elif defined(__UNIX_SV__)
"UNIX_SV"
#elif defined(__bsdos__)
"BSDOS"
#elif defined(_MPRAS) || defined(MPRAS)
"MP-RAS"
#elif defined(__osf) || defined(__osf__)
"OSF1"
#elif defined(_SCO_SV) || defined(SCO_SV) || defined(sco_sv)
"SCO_SV"
#elif defined(__ultrix) || defined(__ultrix__) || defined(_ULTRIX)
"ULTRIX"
#elif defined(__XENIX__) || defined(_XENIX) || defined(XENIX)
"Xenix"
#else /* unknown platform */
""
#endif
"]";
--- NEW FILE: CMakeCCompilerId.c ---
#ifdef __cplusplus
# error "A C++ compiler has been selected for C."
#endif
static char const info_compiler[] = "INFO:compiler["
#if defined(__INTEL_COMPILER) || defined(__ICC)
"Intel"
#elif defined(__BORLANDC__)
"Borland"
#elif defined(__SUNPRO_C)
"SunPro"
#elif defined(__HP_cc)
"HP"
#elif defined(__DECC)
"Compaq"
#elif defined(__IBMC__)
"VisualAge"
#elif defined(__GNUC__)
"GNUC"
#elif defined(_MSC_VER)
"MSVC"
#elif defined(_COMPILER_VERSION)
"MIPSpro"
/* This compiler is either not known or is too old to define an
identification macro. Try to identify the platform and guess that
it is the native compiler. */
#elif defined(__sgi)
"MIPSpro"
#elif defined(__hpua) || defined(__hppx)
"HP"
#else /* unknown compiler */
""
#endif
"]";
/* Include the platform identification source. */
#include "CMakePlatformId.h"
/* Make sure the information strings are referenced. */
int main()
{
return ((int)&info_compiler) + ((int)&info_platform);
}
Index: CMakeDetermineCCompiler.cmake
===================================================================
RCS file: /cvsroot/CMake/CMake/Modules/CMakeDetermineCCompiler.cmake,v
retrieving revision 1.38
retrieving revision 1.38.2.1
diff -u -d -r1.38 -r1.38.2.1
--- CMakeDetermineCCompiler.cmake 29 Aug 2006 17:59:15 -0000 1.38
+++ CMakeDetermineCCompiler.cmake 27 Apr 2007 12:57:38 -0000 1.38.2.1
@@ -53,42 +53,28 @@
ENDIF(NOT CMAKE_RANLIB)
MARK_AS_ADVANCED(CMAKE_RANLIB)
-# do not test for GNU if the generator is visual studio
-IF(${CMAKE_GENERATOR} MATCHES "Visual Studio")
- SET(CMAKE_COMPILER_IS_GNUCC_RUN 1)
-ENDIF(${CMAKE_GENERATOR} MATCHES "Visual Studio")
-
+# Build a small source file to identify the compiler.
+IF(${CMAKE_GENERATOR} MATCHES "(Visual Studio|Xcode)")
+ SET(CMAKE_C_COMPILER_ID_RUN 1)
+ENDIF(${CMAKE_GENERATOR} MATCHES "(Visual Studio|Xcode)")
+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
More information about the Cmake-commits
mailing list