Repository: conan-io/conan-center-index
Issue: [package] benchmark/1.5.0: fails to compile with arm cross-compiler

### Package and Environment Details (include every applicable attribute)
  * Package Name/Version: **benchmark/1.5.0**
  * Operating System+version: **Linux Ubuntu 18.04**
  * Compiler+version: **GCC 7**
  * Docker image: **conanio/gcc8**
  * Conan version: **conan 1.20.4**
  * Python version: **Python 3.6.8**


### Conan profile (output of `conan profile show default` or `conan profile show <profile>` if custom profile is in use)
```
Configuration for profile crosscompile:

[settings]
os=Linux
os_build=Linux
arch=armv7hf
arch_build=x86_64
compiler=gcc
compiler.version=6.2
compiler.libcxx=libstdc++
build_type=Release
[options]
[build_requires]
[env]
CONAN_CMAKE_FIND_ROOT_PATH=/usr/lib/gcc-cross/arm-linux-gnueabihf/7/
CHOST=arm-linux-gnueabihf
AR=arm-linux-gnueabihf-ar
AS=arm-linux-gnueabihf-as
RANLIB=arm-linux-gnueabihf-ranlib
CC=arm-linux-gnueabihf-gcc
CXX=arm-linux-gnueabihf-g++
STRIP=arm-linux-gnueabihf-strip

```

### Steps to reproduce (Include if Applicable)

```
apt install gcc-arm-linux-gnueabihf g++-arm-linux-gnueabihf
cat << EOF > conanfile.txt                                                             
[requires]
benchmark/1.5.0
[generators]
cmake_find_package
cmake_paths
EOF
conan install . --profile=crosscompile -r conan-center --build missing
```

### Logs (Include/Attach if Applicable)
<details><summary>Click to expand log</summary>

```
Configuration:
[settings]
arch=armv7hf
arch_build=x86_64
build_type=Release
compiler=gcc
compiler.libcxx=libstdc++
compiler.version=6.2
os=Linux
os_build=Linux
[options]
[build_requires]
[env]
AR=arm-linux-gnueabihf-ar
AS=arm-linux-gnueabihf-as
CC=arm-linux-gnueabihf-gcc
CHOST=arm-linux-gnueabihf
CONAN_CMAKE_FIND_ROOT_PATH=/usr/lib/gcc-cross/arm-linux-gnueabihf/7/
CXX=arm-linux-gnueabihf-g++
RANLIB=arm-linux-gnueabihf-ranlib
RC=arm-linux-gnueabihf-windres
STRIP=arm-linux-gnueabihf-strip
conanfile.txt: Installing package
Requirements
    benchmark/1.5.0 from 'conan-center' - Cache
Packages
    benchmark/1.5.0:1ae037b23484a7eac58bb45c99e22d387cc378ed - Build

Cross-build from 'Linux:x86_64' to 'Linux:armv7hf'
benchmark/1.5.0: Copying sources to build folder
benchmark/1.5.0: Building your package in /home/tobiask/.conan/data/benchmark/1.5.0/_/_/build/1ae037b23484a7eac58bb45c99e22d387cc378ed
benchmark/1.5.0: Generator cmake created conanbuildinfo.cmake
benchmark/1.5.0: Calling build()
-- The C compiler identification is GNU 7.4.0
-- The CXX compiler identification is GNU 6.2.1
-- Check for working C compiler: /usr/bin/arm-linux-gnueabihf-gcc
-- Check for working C compiler: /usr/bin/arm-linux-gnueabihf-gcc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /opt/linaro/gcc-linaro-arm-linux-gnueabihf/bin/arm-linux-gnueabihf-g++
-- Check for working CXX compiler: /opt/linaro/gcc-linaro-arm-linux-gnueabihf/bin/arm-linux-gnueabihf-g++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Conan: called by CMake conan helper
-- Conan: called inside local cache
-- Conan: Adjusting output directories
-- Conan: Using cmake global configuration
-- Conan: Adjusting default RPATHs Conan policies
-- Conan: Adjusting language standard
-- Conan: Adjusting fPIC flag (ON)
-- Conan: Compiler GCC>=5, checking major version 6.2
-- Conan: Checking correct version: 6.2
-- Conan: C++ stdlib: libstdc++
-- Found Git: /home/tobiask/bin/git (found version "2.24.0") 
-- git Version: v0.0.0
-- Version: 0.0.0
-- Performing Test HAVE_CXX_FLAG_M32
-- Performing Test HAVE_CXX_FLAG_M32 - Failed
CMake Error at source_subfolder/cmake/AddCXXCompilerFlag.cmake:62 (message):
  Required flag '-m32' is not supported by the compiler
Call Stack (most recent call first):
  source_subfolder/CMakeLists.txt:96 (add_required_cxx_compiler_flag)


-- Configuring incomplete, errors occurred!
See also "/home/tobiask/.conan/data/benchmark/1.5.0/_/_/build/1ae037b23484a7eac58bb45c99e22d387cc378ed/build_subfolder/CMakeFiles/CMakeOutput.log".
See also "/home/tobiask/.conan/data/benchmark/1.5.0/_/_/build/1ae037b23484a7eac58bb45c99e22d387cc378ed/build_subfolder/CMakeFiles/CMakeError.log".
benchmark/1.5.0: 
benchmark/1.5.0: ERROR: Package '1ae037b23484a7eac58bb45c99e22d387cc378ed' build failed
benchmark/1.5.0: WARN: Build folder /home/tobiask/.conan/data/benchmark/1.5.0/_/_/build/1ae037b23484a7eac58bb45c99e22d387cc378ed
ERROR: benchmark/1.5.0: Error in build() method, line 63
	cmake = self._configure_cmake()
while calling '_configure_cmake', line 59
	cmake.configure(build_folder=self._build_subfolder)
	ConanException: Error 1 while executing cd '/home/tobiask/.conan/data/benchmark/1.5.0/_/_/build/1ae037b23484a7eac58bb45c99e22d387cc378ed/build_subfolder' && cmake -G "Unix Makefiles" -DCMAKE_BUILD_TYPE="Release" -DCONAN_EXPORTED="1" -DCONAN_IN_LOCAL_CACHE="ON" -DCONAN_COMPILER="gcc" -DCONAN_COMPILER_VERSION="6.2" -DCONAN_LIBCXX="libstdc++" -DBUILD_SHARED_LIBS="OFF" -DCMAKE_INSTALL_PREFIX="/home/tobiask/.conan/data/benchmark/1.5.0/_/_/package/1ae037b23484a7eac58bb45c99e22d387cc378ed" -DCMAKE_INSTALL_BINDIR="bin" -DCMAKE_INSTALL_SBINDIR="bin" -DCMAKE_INSTALL_LIBEXECDIR="bin" -DCMAKE_INSTALL_LIBDIR="lib" -DCMAKE_INSTALL_INCLUDEDIR="include" -DCMAKE_INSTALL_OLDINCLUDEDIR="include" -DCMAKE_INSTALL_DATAROOTDIR="share" -DCONAN_CMAKE_POSITION_INDEPENDENT_CODE="ON" -DCMAKE_EXPORT_NO_PACKAGE_REGISTRY="ON" -DBENCHMARK_ENABLE_TESTING="OFF" -DBENCHMARK_ENABLE_GTEST_TESTS="OFF" -DBENCHMARK_ENABLE_LTO="OFF" -DBENCHMARK_ENABLE_EXCEPTIONS="ON" -DBENCHMARK_BUILD_32_BITS="ON" -DBENCHMARK_USE_LIBCXX="OFF" -Wno-dev '/home/tobiask/.conan/data/benchmark/1.5.0/_/_/build/1ae037b23484a7eac58bb45c99e22d387cc378ed'
```

</details>


Changed files:
recipes/benchmark/all/conanfile.py

diff --git a/recipes/benchmark/all/conanfile.py b/recipes/benchmark/all/conanfile.py
index 584b14f9e..3a9face76 100644
--- a/recipes/benchmark/all/conanfile.py
+++ b/recipes/benchmark/all/conanfile.py
@@ -51,7 +51,12 @@ class BenchmarkConan(ConanFile):
 
         # See https://github.com/google/benchmark/pull/638 for Windows 32 build explanation
         if self.settings.os != "Windows":
-            cmake.definitions["BENCHMARK_BUILD_32_BITS"] = "ON" if "64" not in str(self.settings.arch) else "OFF"
+            if tools.cross_building(self.settings):
+                cmake.definitions["HAVE_STD_REGEX"] = False
+                cmake.definitions["HAVE_POSIX_REGEX"] = False
+                cmake.definitions["HAVE_STEADY_CLOCK"] = False
+            else:
+                cmake.definitions["BENCHMARK_BUILD_32_BITS"] = "ON" if "64" not in str(self.settings.arch) else "OFF"
             cmake.definitions["BENCHMARK_USE_LIBCXX"] = "ON" if (str(self.settings.compiler.libcxx) == "libc++") else "OFF"
         else:
             cmake.definitions["BENCHMARK_USE_LIBCXX"] = "OFF"