[cmake-commits] alex committed CMakeCCompilerId.c 1.4 1.5 CMakeDetermineSystem.cmake 1.21 1.22 CMakePlatformId.h 1.2 1.3 CMakeSystemWithToolchainFile.cmake.in 1.1 1.2

cmake-commits at cmake.org cmake-commits at cmake.org
Tue May 22 12:48:18 EDT 2007


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

Modified Files:
	CMakeCCompilerId.c CMakeDetermineSystem.cmake 
	CMakePlatformId.h CMakeSystemWithToolchainFile.cmake.in 
Log Message:

BUG: now the toolchain file is configured into the buildtree, otherwise e.g.
CMAKE_SOURCE_DIR can't be used there
ENH: modify CMakeCCompilerId.c and .h so that sdcc can compile them. As they
were the preprocessor produced:

 9 "test.c"
static char const info_compiler[] = "INFO:compiler["
# 40 "test.c"
""

"]";

and the mixing of the preprocessing directives and the string constants
didn't work.

Alex


Index: CMakePlatformId.h
===================================================================
RCS file: /cvsroot/CMake/CMake/Modules/CMakePlatformId.h,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- CMakePlatformId.h	28 Apr 2007 13:35:01 -0000	1.2
+++ CMakePlatformId.h	22 May 2007 16:48:16 -0000	1.3
@@ -1,54 +1,78 @@
 /* Identify known platforms by name.  */
-static char const info_platform[] = "INFO:platform["
 #if defined(__linux) || defined(__linux__) || defined(linux)
-"Linux"
+#define _PLATFORM_ID "Linux"
+
 #elif defined(__CYGWIN__)
-"Cygwin"
+#define _PLATFORM_ID "Cygwin"
+
 #elif defined(__MINGW32__)
-"MinGW"
+#define _PLATFORM_ID "MinGW"
+
 #elif defined(__APPLE__)
-"Darwin"
+#define _PLATFORM_ID "Darwin"
+
 #elif defined(_WIN32) || defined(__WIN32__) || defined(WIN32)
-"Windows"
+#define _PLATFORM_ID "Windows"
+
 #elif defined(__FreeBSD__) || defined(__FreeBSD)
-"FreeBSD"
+#define _PLATFORM_ID "FreeBSD"
+
 #elif defined(__NetBSD__) || defined(__NetBSD)
-"NetBSD"
+#define _PLATFORM_ID "NetBSD"
+
 #elif defined(__OpenBSD__) || defined(__OPENBSD)
-"OpenBSD"
+#define _PLATFORM_ID "OpenBSD"
+
 #elif defined(__sun) || defined(sun)
-"SunOS"
+#define _PLATFORM_ID "SunOS"
+
 #elif defined(_AIX) || defined(__AIX) || defined(__AIX__) || defined(__aix) || defined(__aix__)
-"AIX"
+#define _PLATFORM_ID "AIX"
+
 #elif defined(__sgi) || defined(__sgi__) || defined(_SGI)
-"IRIX"
+#define _PLATFORM_ID "IRIX"
+
 #elif defined(__hpux) || defined(__hpux__)
-"HP-UX"
+#define _PLATFORM_ID "HP-UX"
+
 #elif defined(__BeOS) || defined(__BEOS__) || defined(_BEOS)
-"BeOS"
+#define _PLATFORM_ID "BeOS"
+
 #elif defined(__QNX__) || defined(__QNXNTO__)
-"QNX"
+#define _PLATFORM_ID "QNX"
+
 #elif defined(__tru64) || defined(_tru64) || defined(__TRU64__)
-"Tru64"
+#define _PLATFORM_ID "Tru64"
+
 #elif defined(__riscos) || defined(__riscos__)
-"RISCos"
+#define _PLATFORM_ID "RISCos"
+
 #elif defined(__sinix) || defined(__sinix__) || defined(__SINIX__)
-"SINIX"
+#define _PLATFORM_ID "SINIX"
+
 #elif defined(__UNIX_SV__)
-"UNIX_SV"
+#define _PLATFORM_ID "UNIX_SV"
+
 #elif defined(__bsdos__)
-"BSDOS"
+#define _PLATFORM_ID "BSDOS"
+
 #elif defined(_MPRAS) || defined(MPRAS)
-"MP-RAS"
+#define _PLATFORM_ID "MP-RAS"
+
 #elif defined(__osf) || defined(__osf__)
-"OSF1"
+#define _PLATFORM_ID "OSF1"
+
 #elif defined(_SCO_SV) || defined(SCO_SV) || defined(sco_sv)
-"SCO_SV"
+#define _PLATFORM_ID "SCO_SV"
+
 #elif defined(__ultrix) || defined(__ultrix__) || defined(_ULTRIX)
-"ULTRIX"
+#define _PLATFORM_ID "ULTRIX"
+
 #elif defined(__XENIX__) || defined(_XENIX) || defined(XENIX)
-"Xenix"
+#define _PLATFORM_ID "Xenix"
+
 #else /* unknown platform */
-""
+#define _PLATFORM_ID ""
+
 #endif
-"]";
+static char const info_platform[] = "INFO:platform[" _PLATFORM_ID "]";

Index: CMakeDetermineSystem.cmake
===================================================================
RCS file: /cvsroot/CMake/CMake/Modules/CMakeDetermineSystem.cmake,v
retrieving revision 1.21
retrieving revision 1.22
diff -u -d -r1.21 -r1.22
--- CMakeDetermineSystem.cmake	21 May 2007 15:26:40 -0000	1.21
+++ CMakeDetermineSystem.cmake	22 May 2007 16:48:16 -0000	1.22
@@ -27,9 +27,6 @@
 # MacOSX                        Darwin
 
 
-#set the source file which will be configured to become CMakeSystem.cmake
-SET(_CMAKE_SYSTEM_TEMPLATE_FILE ${CMAKE_ROOT}/Modules/CMakeSystem.cmake.in )
-
 IF(CMAKE_TOOLCHAIN_FILE)
   # at first try to load it as path relative to the directory from which cmake has been run
   INCLUDE("${CMAKE_BINARY_DIR}/${CMAKE_TOOLCHAIN_FILE}" OPTIONAL RESULT_VARIABLE _INCLUDED_TOOLCHAIN_FILE)
@@ -44,9 +41,6 @@
     MESSAGE(FATAL_ERROR "Could not find toolchain file: ${CMAKE_TOOLCHAIN_FILE}") 
   ENDIF(_INCLUDED_TOOLCHAIN_FILE)
 
-  # use a different source file for CMakeSystem.cmake, since it has to hold a bit more information
-  SET(_CMAKE_SYSTEM_TEMPLATE_FILE ${CMAKE_ROOT}/Modules/CMakeSystemWithToolchainFile.cmake.in )
-
   IF(NOT DEFINED CMAKE_CROSSCOMPILING)
     SET(CMAKE_CROSSCOMPILING TRUE)
   ENDIF(NOT DEFINED CMAKE_CROSSCOMPILING)
@@ -112,8 +106,23 @@
 FILE(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log 
   "The system is: ${CMAKE_SYSTEM_NAME} - ${CMAKE_SYSTEM_VERSION} - ${CMAKE_SYSTEM_PROCESSOR}\n")
 
-# configure variables set in this file for fast reload, the template file is defined at the top of this file
-CONFIGURE_FILE(${_CMAKE_SYSTEM_TEMPLATE_FILE}
+# if a toolchain file is used use configure_file() to copy it into the 
+# build tree, because this way e.g. ${CMAKE_SOURCE_DIR} will be replaced
+# with its full path, and so it will also work when used in try_compile()
+IF (CMAKE_TOOLCHAIN_FILE)
+  SET(_OWN_DIR ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY})
+  CONFIGURE_FILE(${CMAKE_TOOLCHAIN_FILE}
+               ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeToolchainFile.cmake)
+
+  CONFIGURE_FILE(${CMAKE_ROOT}/Modules/CMakeSystemWithToolchainFile.cmake.in
                ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeSystem.cmake 
                IMMEDIATE @ONLY)
 
+ELSE (CMAKE_TOOLCHAIN_FILE)
+
+  # configure variables set in this file for fast reload, the template file is defined at the top of this file
+  CONFIGURE_FILE(${CMAKE_ROOT}/Modules/CMakeSystem.cmake.in
+                 ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeSystem.cmake 
+                 IMMEDIATE @ONLY)
+
+ENDIF (CMAKE_TOOLCHAIN_FILE)

Index: CMakeCCompilerId.c
===================================================================
RCS file: /cvsroot/CMake/CMake/Modules/CMakeCCompilerId.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- CMakeCCompilerId.c	17 May 2007 14:07:51 -0000	1.4
+++ CMakeCCompilerId.c	22 May 2007 16:48:16 -0000	1.5
@@ -6,40 +6,50 @@
 # define const
 #endif
 
-static char const info_compiler[] = "INFO:compiler["
 #if defined(__INTEL_COMPILER) || defined(__ICC)
-"Intel"
+#define _COMPILER_ID "Intel"
+
 #elif defined(__BORLANDC__)
-"Borland"
+#define _COMPILER_ID "Borland"
+
 #elif defined(__WATCOMC__)
-"Watcom"
+#define _COMPILER_ID "Watcom"
+
 #elif defined(__SUNPRO_C)
-"SunPro"
+#define _COMPILER_ID "SunPro"
+
 #elif defined(__HP_cc)
-"HP"
+#define _COMPILER_ID "HP"
+
 #elif defined(__DECC)
-"Compaq"
+#define _COMPILER_ID "Compaq"
+
 #elif defined(__IBMC__)
-"VisualAge"
+#define _COMPILER_ID "VisualAge"
+
 #elif defined(__GNUC__)
-"GNU"
+#define _COMPILER_ID "GNU"
+
 #elif defined(_MSC_VER)
-"MSVC"
+#define _COMPILER_ID "MSVC"
+
 #elif defined(_COMPILER_VERSION)
-"MIPSpro"
+#define _COMPILER_ID "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"
+#define _COMPILER_ID "MIPSpro"
+
 #elif defined(__hpux) || defined(__hpua)
-"HP"
+#define _COMPILER_ID "HP"
 
 #else /* unknown compiler */
-""
+#define _COMPILER_ID ""
 #endif
-"]";
+
+static char const info_compiler[] = "INFO:compiler[" _COMPILER_ID "]";
 
 /* Include the platform identification source.  */
 #include "CMakePlatformId.h"

Index: CMakeSystemWithToolchainFile.cmake.in
===================================================================
RCS file: /cvsroot/CMake/CMake/Modules/CMakeSystemWithToolchainFile.cmake.in,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- CMakeSystemWithToolchainFile.cmake.in	21 May 2007 15:26:40 -0000	1.1
+++ CMakeSystemWithToolchainFile.cmake.in	22 May 2007 16:48:16 -0000	1.2
@@ -1,5 +1,5 @@
-
-INCLUDE("@CMAKE_TOOLCHAIN_FILE@")
+# the following file has been configured from @CMAKE_TOOLCHAIN_FILE@ 
+INCLUDE(@_OWN_DIR@/CMakeToolchainFile.cmake)
 
 # set CMAKE_SYSTEM to the CMAKE_SYSTEM_NAME
 SET(CMAKE_SYSTEM  ${CMAKE_SYSTEM_NAME})



More information about the Cmake-commits mailing list