Merge pull request #75 from google/outofsource

Add _build to gitignore to enable out-of-source builds
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 480d8a5..d1b2ddc 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -18,14 +18,12 @@
 ExternalProject_Get_Property(googletest binary_dir)
 link_directories(${binary_dir})
 
-# Enable the latest C++ standard possible
+# Try and enable C++11. Don't use C++14 because it doesn't work in some
+# configurations.
 include(CheckCXXCompilerFlag)
-check_cxx_compiler_flag(--std=c++14 HAVE_FLAG_CXX_14)
 check_cxx_compiler_flag(--std=c++11 HAVE_FLAG_CXX_11)
 check_cxx_compiler_flag(--std=c++0x HAVE_FLAG_CXX_0X)
-if (HAVE_FLAG_CXX_14)
-  set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} --std=c++14")
-elseif (HAVE_FLAG_CXX_11)
+if (HAVE_FLAG_CXX_11)
   set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} --std=c++11")
 elseif (HAVE_FLAG_CXX_0X)
   set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} --std=c++0x")
@@ -58,6 +56,10 @@
   add_definitions(-DOS_WINDOWS)
 endif()
 
+if(${CMAKE_SYSTEM_NAME} MATCHES "FreeBSD")
+  add_definitions(-DOS_FREEBSD)
+endif()
+
 # Set CPU
 if(${CMAKE_SYSTEM_PROCESSOR} MATCHES "x86")
   add_definitions(-DARCH_X86)
diff --git a/src/sleep.cc b/src/sleep.cc
index a6bce1d..572d04d 100644
--- a/src/sleep.cc
+++ b/src/sleep.cc
@@ -25,7 +25,7 @@
   SleepForMilliseconds(static_cast<int>(kNumMillisPerSecond * seconds));
 }
 #else   // OS_WINDOWS
-void SleepForMicroseconds(int64_t microseconds) {
+void SleepForMicroseconds(int microseconds) {
   struct timespec sleep_time;
   sleep_time.tv_sec = microseconds / kNumMicrosPerSecond;
   sleep_time.tv_nsec = (microseconds % kNumMicrosPerSecond) * kNumNanosPerMicro;
@@ -34,11 +34,11 @@
 }
 
 void SleepForMilliseconds(int milliseconds) {
-  SleepForMicroseconds(static_cast<int64_t>(milliseconds) * kNumMicrosPerMilli);
+  SleepForMicroseconds(static_cast<int>(milliseconds) * kNumMicrosPerMilli);
 }
 
 void SleepForSeconds(double seconds) {
-  SleepForMicroseconds(static_cast<int64_t>(seconds * kNumMicrosPerSecond));
+  SleepForMicroseconds(static_cast<int>(seconds * kNumMicrosPerSecond));
 }
 #endif  // OS_WINDOWS
 }  // end namespace benchmark
diff --git a/src/sleep.h b/src/sleep.h
index 6d2cc06..4e877bf 100644
--- a/src/sleep.h
+++ b/src/sleep.h
@@ -10,7 +10,6 @@
 const int64_t kNumNanosPerMicro = 1000LL;
 const int64_t kNumNanosPerSecond = kNumNanosPerMicro * kNumMicrosPerSecond;
 
-void SleepForMicroseconds(int64_t microseconds);
 void SleepForMilliseconds(int milliseconds);
 void SleepForSeconds(double seconds);
 }  // end namespace benchmark
diff --git a/src/sysinfo.cc b/src/sysinfo.cc
index 2d1ce24..a67662c 100644
--- a/src/sysinfo.cc
+++ b/src/sysinfo.cc
@@ -17,12 +17,13 @@
 #include <errno.h>
 #include <fcntl.h>
 #include <stdio.h>
+#include <stdint.h>
 #include <stdlib.h>
 #include <string.h>
 #include <sys/resource.h>
+#include <sys/types.h> // this header must be included before 'sys/sysctl.h' to avoid compilation error on FreeBSD
 #include <sys/sysctl.h>
 #include <sys/time.h>
-#include <sys/types.h>
 #include <unistd.h>
 
 #include <iostream>
diff --git a/src/walltime.cc b/src/walltime.cc
index c20066a..8de4770 100644
--- a/src/walltime.cc
+++ b/src/walltime.cc
@@ -15,6 +15,7 @@
 #include "walltime.h"
 
 #include <stdio.h>
+#include <stdint.h>
 #include <string.h>
 #include <sys/time.h>
 #include <time.h>