[cmake-commits] king committed CMakeCCompiler.cmake.in 1.19 1.20
CMakeCCompilerABI.c NONE 1.1 CMakeCXXCompiler.cmake.in 1.18
1.19 CMakeCXXCompilerABI.cpp NONE 1.1 CMakeCompilerABI.h NONE
1.1 CMakeDetermineCompilerABI.cmake NONE 1.1
CMakeTestCCompiler.cmake 1.21 1.22 CMakeTestCXXCompiler.cmake
1.15 1.16
cmake-commits at cmake.org
cmake-commits at cmake.org
Mon Jan 21 18:30:19 EST 2008
Update of /cvsroot/CMake/CMake/Modules
In directory public:/mounts/ram/cvs-serv18530/Modules
Modified Files:
CMakeCCompiler.cmake.in CMakeCXXCompiler.cmake.in
CMakeTestCCompiler.cmake CMakeTestCXXCompiler.cmake
Added Files:
CMakeCCompilerABI.c CMakeCXXCompilerABI.cpp CMakeCompilerABI.h
CMakeDetermineCompilerABI.cmake
Log Message:
ENH: Generalize the check for sizeof void* to detect more ABI information.
--- NEW FILE: CMakeCXXCompilerABI.cpp ---
#ifndef __cplusplus
# error "A C compiler has been selected for C++."
#endif
/*--------------------------------------------------------------------------*/
#include "CMakeCompilerABI.h"
/*--------------------------------------------------------------------------*/
/* Make sure the information strings are referenced. */
#define REQUIRE(x) (&x[0] != &require)
int main()
{
const char require = 0;
return
(
REQUIRE(info_sizeof_dptr)
#if defined(ABI_ID)
&& REQUIRE(info_abi)
#endif
);
}
--- NEW FILE: CMakeCompilerABI.h ---
/*--------------------------------------------------------------------------*/
/* Size of a pointer-to-data in bytes. */
#define SIZEOF_DPTR (sizeof(void*))
const char info_sizeof_dptr[] = {
'I', 'N', 'F', 'O', ':', 's', 'i', 'z', 'e', 'o', 'f', '_', 'd', 'p', 't', 'r', '[',
('0' + ((SIZEOF_DPTR / 10)%10)),
('0' + (SIZEOF_DPTR % 10)),
']','\0'};
/*--------------------------------------------------------------------------*/
/* Application Binary Interface. */
#if defined(__sgi) && defined(_ABIO32)
# define ABI_ID "ELF O32"
#elif defined(__sgi) && defined(_ABIN32)
# define ABI_ID "ELF N32"
#elif defined(__sgi) && defined(_ABI64)
# define ABI_ID "ELF 64"
#elif defined(__ELF__)
# define ABI_ID "ELF"
#endif
#if defined(ABI_ID)
static char const info_abi[] = "INFO:abi[" ABI_ID "]";
#endif
--- NEW FILE: CMakeCCompilerABI.c ---
#ifdef __cplusplus
# error "A C++ compiler has been selected for C."
#endif
#ifdef __CLASSIC_C__
# define const
#endif
/*--------------------------------------------------------------------------*/
#include "CMakeCompilerABI.h"
/*--------------------------------------------------------------------------*/
/* Make sure the information strings are referenced. */
#define REQUIRE(x) (&x[0] != &require)
int main()
{
const char require = 0;
return
(
REQUIRE(info_sizeof_dptr)
#if defined(ABI_ID)
&& REQUIRE(info_abi)
#endif
);
}
Index: CMakeTestCCompiler.cmake
===================================================================
RCS file: /cvsroot/CMake/CMake/Modules/CMakeTestCCompiler.cmake,v
retrieving revision 1.21
retrieving revision 1.22
diff -u -d -r1.21 -r1.22
--- CMakeTestCCompiler.cmake 17 May 2007 17:20:43 -0000 1.21
+++ CMakeTestCCompiler.cmake 21 Jan 2008 23:30:17 -0000 1.22
@@ -40,14 +40,15 @@
"Determining if the C compiler works passed with "
"the following output:\n${OUTPUT}\n\n")
ENDIF(C_TEST_WAS_RUN)
- INCLUDE (${CMAKE_ROOT}/Modules/CheckTypeSize.cmake)
- # Check the size of void*. This used to be "void *" but icc expands the *.
- CHECK_TYPE_SIZE("void*" CMAKE_SIZEOF_VOID_P)
SET(CMAKE_C_COMPILER_WORKS 1 CACHE INTERNAL "")
- # re-configure this file CMakeCCompiler.cmake so that it gets
- # the value for CMAKE_SIZEOF_VOID_P
- # configure variables set in this file for fast reload later on
- CONFIGURE_FILE(${CMAKE_ROOT}/Modules/CMakeCCompiler.cmake.in
- ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeCCompiler.cmake IMMEDIATE)
+
+ # Try to identify the ABI and configure it into CMakeCCompiler.cmake
+ INCLUDE(${CMAKE_ROOT}/Modules/CMakeDetermineCompilerABI.cmake)
+ CMAKE_DETERMINE_COMPILER_ABI(C ${CMAKE_ROOT}/Modules/CMakeCCompilerABI.c)
+ CONFIGURE_FILE(
+ ${CMAKE_ROOT}/Modules/CMakeCCompiler.cmake.in
+ ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeCCompiler.cmake
+ @ONLY
+ )
ENDIF(NOT CMAKE_C_COMPILER_WORKS)
Index: CMakeTestCXXCompiler.cmake
===================================================================
RCS file: /cvsroot/CMake/CMake/Modules/CMakeTestCXXCompiler.cmake,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -d -r1.15 -r1.16
--- CMakeTestCXXCompiler.cmake 14 Jun 2006 16:28:29 -0000 1.15
+++ CMakeTestCXXCompiler.cmake 21 Jan 2008 23:30:17 -0000 1.16
@@ -34,4 +34,13 @@
"the following output:\n${OUTPUT}\n\n")
ENDIF(CXX_TEST_WAS_RUN)
SET(CMAKE_CXX_COMPILER_WORKS 1 CACHE INTERNAL "")
+
+ # Try to identify the ABI and configure it into CMakeCXXCompiler.cmake
+ INCLUDE(${CMAKE_ROOT}/Modules/CMakeDetermineCompilerABI.cmake)
+ CMAKE_DETERMINE_COMPILER_ABI(CXX ${CMAKE_ROOT}/Modules/CMakeCXXCompilerABI.cpp)
+ CONFIGURE_FILE(
+ ${CMAKE_ROOT}/Modules/CMakeCXXCompiler.cmake.in
+ ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeCXXCompiler.cmake
+ @ONLY
+ )
ENDIF(NOT CMAKE_CXX_COMPILER_WORKS)
Index: CMakeCCompiler.cmake.in
===================================================================
RCS file: /cvsroot/CMake/CMake/Modules/CMakeCCompiler.cmake.in,v
retrieving revision 1.19
retrieving revision 1.20
diff -u -d -r1.19 -r1.20
--- CMakeCCompiler.cmake.in 12 Jul 2007 12:37:10 -0000 1.19
+++ CMakeCCompiler.cmake.in 21 Jan 2008 23:30:17 -0000 1.20
@@ -23,6 +23,14 @@
SET(CMAKE_C_IGNORE_EXTENSIONS h;H;o;O;obj;OBJ;def;DEF;rc;RC)
SET(CMAKE_C_LINKER_PREFERENCE 10)
-# save the size of void* in case where cache is removed
-# and the this file is still around
-SET(CMAKE_SIZEOF_VOID_P @CMAKE_SIZEOF_VOID_P@)
+# Save compiler ABI information.
+SET(CMAKE_C_SIZEOF_DATA_PTR "@CMAKE_C_SIZEOF_DATA_PTR@")
+SET(CMAKE_C_COMPILER_ABI "@CMAKE_C_COMPILER_ABI@")
+
+IF(CMAKE_C_SIZEOF_DATA_PTR)
+ SET(CMAKE_SIZEOF_VOID_P "${CMAKE_C_SIZEOF_DATA_PTR}")
+ENDIF(CMAKE_C_SIZEOF_DATA_PTR)
+
+IF(CMAKE_C_COMPILER_ABI)
+ SET(CMAKE_INTERNAL_PLATFORM_ABI "${CMAKE_C_COMPILER_ABI}")
+ENDIF(CMAKE_C_COMPILER_ABI)
Index: CMakeCXXCompiler.cmake.in
===================================================================
RCS file: /cvsroot/CMake/CMake/Modules/CMakeCXXCompiler.cmake.in,v
retrieving revision 1.18
retrieving revision 1.19
diff -u -d -r1.18 -r1.19
--- CMakeCXXCompiler.cmake.in 12 Jul 2007 12:37:10 -0000 1.18
+++ CMakeCXXCompiler.cmake.in 21 Jan 2008 23:30:17 -0000 1.19
@@ -23,6 +23,14 @@
SET(CMAKE_CXX_SOURCE_FILE_EXTENSIONS C;M;c++;cc;cpp;cxx;m;mm)
SET(CMAKE_CXX_LINKER_PREFERENCE 30)
-# save the size of void* in case where cache is removed
-# and the this file is still around
-SET(CMAKE_SIZEOF_VOID_P @CMAKE_SIZEOF_VOID_P@)
+# Save compiler ABI information.
+SET(CMAKE_CXX_SIZEOF_DATA_PTR "@CMAKE_CXX_SIZEOF_DATA_PTR@")
+SET(CMAKE_CXX_COMPILER_ABI "@CMAKE_CXX_COMPILER_ABI@")
+
+IF(CMAKE_CXX_SIZEOF_DATA_PTR)
+ SET(CMAKE_SIZEOF_VOID_P "${CMAKE_CXX_SIZEOF_DATA_PTR}")
+ENDIF(CMAKE_CXX_SIZEOF_DATA_PTR)
+
+IF(CMAKE_CXX_COMPILER_ABI)
+ SET(CMAKE_INTERNAL_PLATFORM_ABI "${CMAKE_CXX_COMPILER_ABI}")
+ENDIF(CMAKE_CXX_COMPILER_ABI)
--- NEW FILE: CMakeDetermineCompilerABI.cmake ---
# Function to compile a source file to identify the compiler ABI.
# This is used internally by CMake and should not be included by user
# code.
FUNCTION(CMAKE_DETERMINE_COMPILER_ABI lang src)
IF(NOT DEFINED CMAKE_DETERMINE_${lang}_ABI_COMPILED)
MESSAGE(STATUS "Detecting ${lang} compiler info")
# Compile the ABI identification source.
SET(BIN "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeDetermineCompilerABI_${lang}.bin")
TRY_COMPILE(CMAKE_DETERMINE_${lang}_ABI_COMPILED
${CMAKE_BINARY_DIR} ${src}
OUTPUT_VARIABLE OUTPUT
COPY_FILE "${BIN}"
)
# Load the resulting information strings.
IF(CMAKE_DETERMINE_${lang}_ABI_COMPILED)
MESSAGE(STATUS "Detecting ${lang} compiler info - done")
FILE(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log
"Detecting ${lang} compiler info compiled with the following output:\n${OUTPUT}\n\n")
FILE(STRINGS "${BIN}" ABI_STRINGS LIMIT_COUNT 2 REGEX "INFO:[^[]*\\[")
FOREACH(info ${ABI_STRINGS})
IF("${info}" MATCHES ".*INFO:sizeof_dptr\\[0*([^]]*)\\].*")
STRING(REGEX REPLACE ".*INFO:sizeof_dptr\\[0*([^]]*)\\].*" "\\1" ABI_SIZEOF_DPTR "${info}")
ENDIF("${info}" MATCHES ".*INFO:sizeof_dptr\\[0*([^]]*)\\].*")
IF("${info}" MATCHES ".*INFO:abi\\[([^]]*)\\].*")
STRING(REGEX REPLACE ".*INFO:abi\\[([^]]*)\\].*" "\\1" ABI_NAME "${info}")
ENDIF("${info}" MATCHES ".*INFO:abi\\[([^]]*)\\].*")
ENDFOREACH(info)
IF(ABI_SIZEOF_DPTR)
SET(CMAKE_${lang}_SIZEOF_DATA_PTR "${ABI_SIZEOF_DPTR}" PARENT_SCOPE)
SET(CMAKE_SIZEOF_VOID_P "${ABI_SIZEOF_DPTR}" PARENT_SCOPE)
ENDIF(ABI_SIZEOF_DPTR)
IF(ABI_NAME)
SET(CMAKE_${lang}_COMPILER_ABI "${ABI_NAME}" PARENT_SCOPE)
SET(CMAKE_INTERNAL_PLATFORM_ABI "${ABI_NAME}" PARENT_SCOPE)
ENDIF(ABI_NAME)
ELSE(CMAKE_DETERMINE_${lang}_ABI_COMPILED)
MESSAGE(STATUS "Detecting ${lang} compiler info - failed")
FILE(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log
"Detecting ${lang} compiler info failed to compile with the following output:\n${OUTPUT}\n\n")
ENDIF(CMAKE_DETERMINE_${lang}_ABI_COMPILED)
ENDIF(NOT DEFINED CMAKE_DETERMINE_${lang}_ABI_COMPILED)
ENDFUNCTION(CMAKE_DETERMINE_COMPILER_ABI)
More information about the Cmake-commits
mailing list