[Cmake-commits] [cmake-commits] king committed CMakeCCompilerId.c.in 1.2 1.3 CMakeCXXCompilerId.cpp.in 1.1 1.2 CMakePlatformId.h.in 1.1 1.2

cmake-commits at cmake.org cmake-commits at cmake.org
Mon Mar 10 09:32:27 EDT 2008


Update of /cvsroot/CMake/CMake/Modules
In directory public:/mounts/ram/cvs-serv18277/Modules

Modified Files:
	CMakeCCompilerId.c.in CMakeCXXCompilerId.cpp.in 
	CMakePlatformId.h.in 
Log Message:
ENH: Make compiler id detection more robust

  - Split INFO strings in source into multiple pieces
    to make sure assembly or other listings produced
    by the compiler are never matched by the regex
  - Store INFO strings via pointer instead of array
    to convince some compilers to store the string
    literally in the binary
  - This should help make it work for sdcc 2.8.0 RC1


Index: CMakeCCompilerId.c.in
===================================================================
RCS file: /cvsroot/CMake/CMake/Modules/CMakeCCompilerId.c.in,v
retrieving revision 1.2
retrieving revision 1.3
diff -C 2 -d -r1.2 -r1.3
*** CMakeCCompilerId.c.in	25 Feb 2008 23:47:19 -0000	1.2
--- CMakeCCompilerId.c.in	10 Mar 2008 13:32:25 -0000	1.3
***************
*** 76,80 ****
  #endif
  
! char info_compiler[] = "INFO:compiler[" COMPILER_ID "]";
  
  @CMAKE_C_COMPILER_ID_PLATFORM_CONTENT@
--- 76,84 ----
  #endif
  
! /* Construct the string literal in pieces to prevent the source from
!    getting matched.  Store it in a pointer rather than an array
!    because some compilers will just produce instructions to fill the
!    array rather than assigning a pointer to a static array.  */
! char* info_compiler = "INFO" ":" "compiler[" COMPILER_ID "]";
  
  @CMAKE_C_COMPILER_ID_PLATFORM_CONTENT@

Index: CMakePlatformId.h.in
===================================================================
RCS file: /cvsroot/CMake/CMake/Modules/CMakePlatformId.h.in,v
retrieving revision 1.1
retrieving revision 1.2
diff -C 2 -d -r1.1 -r1.2
*** CMakePlatformId.h.in	25 Feb 2008 14:23:14 -0000	1.1
--- CMakePlatformId.h.in	10 Mar 2008 13:32:25 -0000	1.2
***************
*** 77,79 ****
  #endif
  
! char info_platform[] = "INFO:platform[" PLATFORM_ID "]";
--- 77,83 ----
  #endif
  
! /* Construct the string literal in pieces to prevent the source from
!    getting matched.  Store it in a pointer rather than an array
!    because some compilers will just produce instructions to fill the
!    array rather than assigning a pointer to a static array.  */
! char* info_platform = "INFO" ":" "platform[" PLATFORM_ID "]";

Index: CMakeCXXCompilerId.cpp.in
===================================================================
RCS file: /cvsroot/CMake/CMake/Modules/CMakeCXXCompilerId.cpp.in,v
retrieving revision 1.1
retrieving revision 1.2
diff -C 2 -d -r1.1 -r1.2
*** CMakeCXXCompilerId.cpp.in	25 Feb 2008 14:23:14 -0000	1.1
--- CMakeCXXCompilerId.cpp.in	10 Mar 2008 13:32:25 -0000	1.2
***************
*** 64,68 ****
  #endif
  
! char info_compiler[] = "INFO:compiler[" COMPILER_ID "]";
  
  @CMAKE_CXX_COMPILER_ID_PLATFORM_CONTENT@
--- 64,72 ----
  #endif
  
! /* Construct the string literal in pieces to prevent the source from
!    getting matched.  Store it in a pointer rather than an array
!    because some compilers will just produce instructions to fill the
!    array rather than assigning a pointer to a static array.  */
! char* info_compiler = "INFO" ":" "compiler[" COMPILER_ID "]";
  
  @CMAKE_CXX_COMPILER_ID_PLATFORM_CONTENT@



More information about the Cmake-commits mailing list