You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
CMakeLists.txt has an option BENCHMARK_BUILD_32_BITS. This works when gcc is used, but it fails with MSVC. In fact this option tries to add -m32 to the compiler options, and this is gcc-specific and doesn't work with MSVC.
With MSVC this option doesn't really make sense, because the CMake MSVC generator determines whether the build is 32-bit or 64-bit. An MSVC user probably doesn't want or expect that setting BENCHMARK_BUILD_32_BITS would make the build fail. Therefore, I propose that BENCHMARK_BUILD_32_BITS be ignored when using MSVC. Doing this is a trivial change to CMakeLists.txt, moving the -m32 stuff so that it is not used with MSVC.
CMakeLists.txt has an option BENCHMARK_BUILD_32_BITS. This works when gcc is used, but it fails with MSVC. In fact this option tries to add -m32 to the compiler options, and this is gcc-specific and doesn't work with MSVC.
With MSVC this option doesn't really make sense, because the CMake MSVC generator determines whether the build is 32-bit or 64-bit. An MSVC user probably doesn't want or expect that setting BENCHMARK_BUILD_32_BITS would make the build fail. Therefore, I propose that BENCHMARK_BUILD_32_BITS be ignored when using MSVC. Doing this is a trivial change to CMakeLists.txt, moving the -m32 stuff so that it is not used with MSVC.
Here's a diff:
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 4265a6c..74fe2ea 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -37,10 +37,6 @@ include(CheckCXXCompilerFlag)
include(AddCXXCompilerFlag)
include(CXXFeatureCheck)
-if (BENCHMARK_BUILD_32_BITS)
-endif()
if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC")
Turn compiler warnings up to 11
string(REGEX REPLACE "[-/]W[1-4]" "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
@@ -72,6 +68,10 @@ if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC")
set(CMAKE_EXE_LINKER_FLAGS_MINSIZEREL "${CMAKE_EXE_LINKER_FLAGS_MINSIZEREL} /LTCG")
endif()
else()
Try and enable C++11. Don't use C++14 because it doesn't work in some
configurations.
add_cxx_compiler_flag(-std=c++11)The text was updated successfully, but these errors were encountered: