Commit 41181669 authored by Andreas Schuh's avatar Andreas Schuh

Use OS_WINDOWS #define instead of _WIN32 and WINDOWS.

The OS_WINDOWS #define has previously been used in gflags.cc before the CMake migration.
parent dbc09f12
cmake_minimum_required(VERSION 2.8.4 FATAL_ERROR)
if (WIN32 AND NOT CYGWIN)
set (WINDOWS 1)
set (OS_WINDOWS 1)
else ()
set (WINDOWS 0)
set (OS_WINDOWS 0)
endif ()
# ----------------------------------------------------------------------------
......@@ -34,7 +34,7 @@ version_numbers (
# configure options
option (BUILD_SHARED_LIBS "Request build of shared libraries." OFF)
if (WINDOWS AND BUILD_SHARED_LIBS)
if (OS_WINDOWS AND BUILD_SHARED_LIBS)
set (GFLAGS_IS_A_DLL 1)
else ()
set (GFLAGS_IS_A_DLL 0)
......@@ -184,7 +184,7 @@ set (GFLAGS_SRCS
"gflags_completions.cc"
)
if (WINDOWS)
if (OS_WINDOWS)
list (APPEND PRIVATE_HDRS "windows_port.h")
list (APPEND GFLAGS_SRCS "windows_port.cc")
endif ()
......@@ -226,7 +226,7 @@ endif ()
# ----------------------------------------------------------------------------
# installation
if (WINDOWS)
if (OS_WINDOWS)
set (RUNTIME_INSTALL_DIR Bin)
set (LIBRARY_INSTALL_DIR Lib)
set (INCLUDE_INSTALL_DIR Include)
......
......@@ -5,6 +5,9 @@
// ---------------------------------------------------------------------------
// System checks
// Define if you build this library for a MS Windows OS.
#cmakedefine OS_WINDOWS
// Define if you have the <stdint.h> header file.
#cmakedefine HAVE_STDINT_H
......@@ -73,7 +76,7 @@
// ---------------------------------------------------------------------------
// Path separator
#ifndef PATH_SEPARATOR
# if _WIN32
# ifdef OS_WINDOWS
# define PATH_SEPARATOR '\\'
# else
# define PATH_SEPARATOR '/'
......@@ -101,7 +104,7 @@
# define GFLAGS_DLL_DEFINE_FLAG GFLAGS_DLL_DECL
#endif
#ifdef _WIN32
#ifdef OS_WINDOWS
// The unittests import the symbols of the shared gflags library
# if GFLAGS_IS_A_DLL && defined(_MSC_VER)
# define GFLAGS_DLL_DECL_FOR_UNITTESTS __declspec(dllimport)
......
......@@ -1494,7 +1494,7 @@ const char* ProgramInvocationName() { // like the GNU libc fn
}
const char* ProgramInvocationShortName() { // like the GNU libc fn
const char* slash = strrchr(argv0, '/');
#ifdef _WINDOWS
#ifdef OS_WINDOWS
if (!slash) slash = strrchr(argv0, '\\');
#endif
return slash ? slash + 1 : argv0;
......
......@@ -110,7 +110,7 @@
#if defined(NO_THREADS)
typedef int MutexType; // to keep a lock-count
#elif defined(_WIN32) || defined(__CYGWIN32__) || defined(__CYGWIN64__)
#elif defined(OS_WINDOWS)
# ifndef WIN32_LEAN_AND_MEAN
# define WIN32_LEAN_AND_MEAN // We only need minimal includes
# endif
......@@ -227,7 +227,7 @@ bool Mutex::TryLock() { if (mutex_) return false; Lock(); return true; }
void Mutex::ReaderLock() { assert(++mutex_ > 0); }
void Mutex::ReaderUnlock() { assert(mutex_-- > 0); }
#elif defined(_WIN32) || defined(__CYGWIN32__) || defined(__CYGWIN64__)
#elif defined(OS_WINDOWS)
Mutex::Mutex() : destroy_(true) {
InitializeCriticalSection(&mutex_);
......
......@@ -65,7 +65,7 @@ extern GFLAGS_DLL_DECL void (*gflags_exitfunc)(int);
#elif defined(HAVE_STRTOQ)
# define strto64 strtoq
# define strtou64 strtouq
#elif defined(_WIN32) && !defined(__MINGW32__) && !defined(__MINGW64__)
#elif defined(OS_WINDOWS)
# define strto64 _strtoi64
# define strtou64 _strtoui64
// Neither strtoll nor strtoq are defined. I hope strtol works!
......
......@@ -112,7 +112,7 @@ inline void setenv(const char* name, const char* value, int) {
#define PRId64 "I64d"
#define PRIu64 "I64u"
#ifndef __MINGW32__
#if !defined(__MINGW32__) && !defined(__MINGW64__)
#define strtoq _strtoi64
#define strtouq _strtoui64
#define strtoll _strtoi64
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment