Explorar o código

Fix builtin_atomics check in CMakeLists.txt

Ben Bader %!s(int64=6) %!d(string=hai) anos
pai
achega
56e7bdf278
Modificáronse 1 ficheiros con 3 adicións e 0 borrados
  1. 3 0
      cmake/CMakeLists.txt

+ 3 - 0
cmake/CMakeLists.txt

@@ -137,6 +137,8 @@ endif (HAVE_ZLIB)
 set(protobuf_LINK_LIBATOMIC false)
 if (NOT MSVC)
   include(CheckCXXSourceCompiles)
+  set(OLD_CMAKE_REQUIRED_FLAGS ${CMAKE_REQUIRED_FLAGS})
+  set(CMAKE_REQUIRED_FLAGS ${CMAKE_REQUIRED_FLAGS} -std=c++11)
   check_cxx_source_compiles("
     #include <atomic>
     int main() {
@@ -146,6 +148,7 @@ if (NOT MSVC)
   if (NOT protobuf_HAVE_BUILTIN_ATOMICS)
     set(protobuf_LINK_LIBATOMIC true)
   endif (NOT protobuf_HAVE_BUILTIN_ATOMICS)
+  set(CMAKE_REQUIRED_FLAGS ${OLD_CMAKE_REQUIRED_FLAGS})
 endif (NOT MSVC)
 
 if (protobuf_BUILD_SHARED_LIBS)