[CMake] Cmake broken on ARM

Pierre Habouzit madcoder at debian.org
Tue May 13 04:28:54 EDT 2008


  The last cmake version broke on arm because of cmsys/CPU.h that don't
know about this architecture. I'm sending a patch to fix this but please
note that on platforms with a Glibc, the header <endian.h> provides the
proper informations.

  A proper patch would be something like:

/* Glibc powered systems */
#elif defined(__GLIBC__)
# include <endian.h>
# if __BYTE_ORDER == __LITTLE_ENDIAN
#  define @KWSYS_NAMESPACE at _CPU_ENDIAN_ID @KWSYS_NAMESPACE at _CPU_ENDIAN_ID_LITTLE
# elif __BYTE_ORDER == __BIG_ENDIAN
#  define @KWSYS_NAMESPACE at _CPU_ENDIAN_ID @KWSYS_NAMESPACE at _CPU_ENDIAN_ID_BIG
# else
#  error glibc doesn't know your byte order
# endif

But this only works if any libc header is included first (features.h that is a
glibc only header defines __GLIBC__), so you probably want to detect
glibc another way and use that instead.

  As I'm pretty clueless about how to do that properly without breaking
anything, I'm sending the current simple patch to fix just arm:

--- cmake-2.6.0.orig/Source/kwsys/CPU.h.in
+++ cmake-2.6.0/Source/kwsys/CPU.h.in
@@ -28,6 +28,14 @@
 #elif defined(__BIG_ENDIAN__)
 # define @KWSYS_NAMESPACE at _CPU_ENDIAN_ID @KWSYS_NAMESPACE at _CPU_ENDIAN_ID_BIG
 
+/* Arm */
+#elif defined(__arm__)
+# if !defined(__ARMEB__)
+#  define @KWSYS_NAMESPACE at _CPU_ENDIAN_ID @KWSYS_NAMESPACE at _CPU_ENDIAN_ID_LITTLE
+# else
+#  define @KWSYS_NAMESPACE at _CPU_ENDIAN_ID @KWSYS_NAMESPACE at _CPU_ENDIAN_ID_BIG
+# endif
+
 /* Alpha */
 #elif defined(__alpha) || defined(__alpha__) || defined(_M_ALPHA)
 # define @KWSYS_NAMESPACE at _CPU_ENDIAN_ID @KWSYS_NAMESPACE at _CPU_ENDIAN_ID_LITTLE
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
URL: <http://www.cmake.org/pipermail/cmake/attachments/20080513/8e0441eb/attachment.pgp>


More information about the CMake mailing list