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