Use CHECK_C_SOURCE_COMPILES instead of CHECK_C_SOURCE_RUNS in order to be
cross-compile friendly.
In buildroot another solution (maybe better, maybe not) could be to use
BR2_ARCH_HAS_ATOMICS in order to determine the value of HAVE_IB_GCC_ATOMIC_BUILTINS_BYTE
and likes.

--- a/storage/innobase/CMakeLists.txt	2014-11-07 17:05:48.853208487 +0100
+++ b/storage/innobase/CMakeLists.txt	2014-11-07 17:11:38.061217839 +0100
@@ -58,100 +58,99 @@
 
 IF(NOT MSVC)
 # either define HAVE_IB_GCC_ATOMIC_BUILTINS or not
-IF(NOT CMAKE_CROSSCOMPILING)
-  # workaround for gcc 4.1.2 RHEL5/x86, gcc atomic ops only work under -march=i686
-  IF(CMAKE_SYSTEM_PROCESSOR STREQUAL "i686" AND CMAKE_COMPILER_IS_GNUCC AND
-     CMAKE_C_COMPILER_VERSION VERSION_LESS "4.1.3")
-    SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -march=i686")
-    SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -march=i686")
-  ENDIF()
-  CHECK_C_SOURCE_RUNS(
-  "
-  int main()
-  {
-    long	x;
-    long	y;
-    long	res;
-
-    x = 10;
-    y = 123;
-    res = __sync_bool_compare_and_swap(&x, x, y);
-    if (!res || x != y) {
-      return(1);
-    }
-
-    x = 10;
-    y = 123;
-    res = __sync_bool_compare_and_swap(&x, x + 1, y);
-    if (res || x != 10) {
-      return(1);
-    }
-    x = 10;
-    y = 123;
-    res = __sync_add_and_fetch(&x, y);
-    if (res != 123 + 10 || x != 123 + 10) {
-      return(1);
-    }
-    return(0);
-  }"
-  HAVE_IB_GCC_ATOMIC_BUILTINS
-  )
-  CHECK_C_SOURCE_RUNS(
-  "
-  int main()
-  {
-    long	res;
-    char	c;
-
-    c = 10;
-    res = __sync_lock_test_and_set(&c, 123);
-    if (res != 10 || c != 123) {
-      return(1);
-    }
-    return(0);
-  }"
-  HAVE_IB_GCC_ATOMIC_BUILTINS_BYTE
-  )
-  CHECK_C_SOURCE_RUNS(
-  "#include<stdint.h>
-  int main()
-  {
-    int64_t	x,y,res;
-
-    x = 10;
-    y = 123;
-    res = __sync_sub_and_fetch(&y, x);
-    if (res != y || y != 113) {
-      return(1);
-    }
-    res = __sync_add_and_fetch(&y, x);
-    if (res != y || y != 123) {
-      return(1);
-    }
-    return(0);
-  }"
-  HAVE_IB_GCC_ATOMIC_BUILTINS_64
-  )
-  CHECK_C_SOURCE_RUNS(
-  "#include<stdint.h>
-  int main()
-  {
-    __sync_synchronize();
-    return(0);
-  }"
-  HAVE_IB_GCC_SYNC_SYNCHRONISE
-  )
-  CHECK_C_SOURCE_RUNS(
-  "#include<stdint.h>
-  int main()
-  {
-    __atomic_thread_fence(__ATOMIC_ACQUIRE);
-    __atomic_thread_fence(__ATOMIC_RELEASE);
-    return(0);
-  }"
-  HAVE_IB_GCC_ATOMIC_THREAD_FENCE
-  )
-ENDIF()
+
+# workaround for gcc 4.1.2 RHEL5/x86, gcc atomic ops only work under -march=i686
+IF(CMAKE_SYSTEM_PROCESSOR STREQUAL "i686" AND CMAKE_COMPILER_IS_GNUCC AND
+   CMAKE_C_COMPILER_VERSION VERSION_LESS "4.1.3")
+  SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -march=i686")
+  SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -march=i686")
+ENDIF()
+CHECK_C_SOURCE_COMPILES(
+"
+int main()
+{
+  long	x;
+  long	y;
+  long	res;
+
+  x = 10;
+  y = 123;
+  res = __sync_bool_compare_and_swap(&x, x, y);
+  if (!res || x != y) {
+    return(1);
+  }
+
+  x = 10;
+  y = 123;
+  res = __sync_bool_compare_and_swap(&x, x + 1, y);
+  if (res || x != 10) {
+    return(1);
+  }
+  x = 10;
+  y = 123;
+  res = __sync_add_and_fetch(&x, y);
+  if (res != 123 + 10 || x != 123 + 10) {
+    return(1);
+  }
+  return(0);
+}"
+HAVE_IB_GCC_ATOMIC_BUILTINS
+)
+CHECK_C_SOURCE_COMPILES(
+"
+int main()
+{
+  long	res;
+  char	c;
+
+  c = 10;
+  res = __sync_lock_test_and_set(&c, 123);
+  if (res != 10 || c != 123) {
+    return(1);
+  }
+  return(0);
+}"
+HAVE_IB_GCC_ATOMIC_BUILTINS_BYTE
+)
+CHECK_C_SOURCE_COMPILES(
+"#include<stdint.h>
+int main()
+{
+  int64_t	x,y,res;
+
+  x = 10;
+  y = 123;
+  res = __sync_sub_and_fetch(&y, x);
+  if (res != y || y != 113) {
+    return(1);
+  }
+  res = __sync_add_and_fetch(&y, x);
+  if (res != y || y != 123) {
+    return(1);
+  }
+  return(0);
+}"
+HAVE_IB_GCC_ATOMIC_BUILTINS_64
+)
+CHECK_C_SOURCE_COMPILES(
+"#include<stdint.h>
+int main()
+{
+  __sync_synchronize();
+  return(0);
+}"
+HAVE_IB_GCC_SYNC_SYNCHRONISE
+)
+CHECK_C_SOURCE_COMPILES(
+"#include<stdint.h>
+int main()
+{
+  __atomic_thread_fence(__ATOMIC_ACQUIRE);
+  __atomic_thread_fence(__ATOMIC_RELEASE);
+return(0);
+}"
+HAVE_IB_GCC_ATOMIC_THREAD_FENCE
+)
 
 IF(HAVE_IB_GCC_ATOMIC_BUILTINS)
  ADD_DEFINITIONS(-DHAVE_IB_GCC_ATOMIC_BUILTINS=1)
@@ -173,28 +172,26 @@
  ADD_DEFINITIONS(-DHAVE_IB_GCC_ATOMIC_THREAD_FENCE=1)
 ENDIF()
 
- # either define HAVE_IB_ATOMIC_PTHREAD_T_GCC or not
-IF(NOT CMAKE_CROSSCOMPILING)
-  CHECK_C_SOURCE_RUNS(
-  "
-  #include <pthread.h>
-  #include <string.h>
-
-  int main() {
-    pthread_t       x1;
-    pthread_t       x2;
-    pthread_t       x3;
-
-    memset(&x1, 0x0, sizeof(x1));
-    memset(&x2, 0x0, sizeof(x2));
-    memset(&x3, 0x0, sizeof(x3));
-
-    __sync_bool_compare_and_swap(&x1, x2, x3);
-
-    return(0);
-  }"
-  HAVE_IB_ATOMIC_PTHREAD_T_GCC)
-ENDIF()
+# either define HAVE_IB_ATOMIC_PTHREAD_T_GCC or not
+CHECK_C_SOURCE_COMPILES(
+"
+#include <pthread.h>
+#include <string.h>
+
+int main() {
+  pthread_t       x1;
+  pthread_t       x2;
+  pthread_t       x3;
+
+  memset(&x1, 0x0, sizeof(x1));
+  memset(&x2, 0x0, sizeof(x2));
+  memset(&x3, 0x0, sizeof(x3));
+  __sync_bool_compare_and_swap(&x1, x2, x3);
+
+  return(0);
+}"
+HAVE_IB_ATOMIC_PTHREAD_T_GCC)
+
 IF(HAVE_IB_ATOMIC_PTHREAD_T_GCC)
   ADD_DEFINITIONS(-DHAVE_IB_ATOMIC_PTHREAD_T_GCC=1)
 ENDIF()
