diff options
author | Andreas Schuh <andreas.schuh.84@gmail.com> | 2014-03-18 22:03:10 +0000 |
---|---|---|
committer | Andreas Schuh <andreas.schuh.84@gmail.com> | 2014-03-18 22:03:10 +0000 |
commit | 492ac156bc6b6e8dfbb8c93c6bdb5d57b346f925 (patch) | |
tree | 4cde051e1865c82aec443fbb6bff1456a36ee727 /src/gflags.cc | |
parent | cf92ec3bf01476f72ad48eb20cfcaceadf25ee6b (diff) | |
download | gflags-492ac156bc6b6e8dfbb8c93c6bdb5d57b346f925.tar.gz gflags-492ac156bc6b6e8dfbb8c93c6bdb5d57b346f925.tar.bz2 gflags-492ac156bc6b6e8dfbb8c93c6bdb5d57b346f925.zip |
Fix DLL build on Windows and use PathMatchSpec instead of fnmatch.
Expose as few system variables as possible through public interface.
Perform STRIP_FLAGS_HELP test using CMake instead of Bash.
Change file path separator used by gflags_reporting.cc to backslash on Windwos.
Diffstat (limited to 'src/gflags.cc')
-rw-r--r-- | src/gflags.cc | 24 |
1 files changed, 10 insertions, 14 deletions
diff --git a/src/gflags.cc b/src/gflags.cc index 7033876..dc1616d 100644 --- a/src/gflags.cc +++ b/src/gflags.cc @@ -93,8 +93,11 @@ #include <assert.h> #include <ctype.h> #include <errno.h> -#ifdef GFLAGS_HAVE_FNMATCH_H +#if defined(GFLAGS_HAVE_FNMATCH_H) # include <fnmatch.h> +#elif defined(GFLAGS_HAVE_SHLWAPI_H) +# include <shlwapi.h> +# pragma comment(lib, "shlwapi.lib") #endif #include <stdarg.h> // For va_list and related operations #include <stdio.h> @@ -109,12 +112,6 @@ #include "mutex.h" #include "util.h" -// Export the following flags only if the gflags library is a DLL -#ifndef GFLAGS_SHARED_LIBS -# undef GFLAGS_DLL_DEFINE_FLAG -# define GFLAGS_DLL_DEFINE_FLAG -#endif - // Special flags, type 1: the 'recursive' flags. They set another flag's val. DEFINE_string(flagfile, "", "load flags from file"); DEFINE_string(fromenv, "", "set flags from the environment" @@ -1310,13 +1307,12 @@ string CommandLineFlagParser::ProcessOptionsFromStringLocked( // We try matching both against the full argv0 and basename(argv0) if (glob == ProgramInvocationName() // small optimization || glob == ProgramInvocationShortName() -#ifdef GFLAGS_HAVE_FNMATCH_H - || fnmatch(glob.c_str(), - ProgramInvocationName(), - FNM_PATHNAME) == 0 - || fnmatch(glob.c_str(), - ProgramInvocationShortName(), - FNM_PATHNAME) == 0 +#if defined(GFLAGS_HAVE_FNMATCH_H) + || fnmatch(glob.c_str(), ProgramInvocationName(), FNM_PATHNAME) == 0 + || fnmatch(glob.c_str(), ProgramInvocationShortName(), FNM_PATHNAME) == 0 +#elif defined(GFLAGS_HAVE_SHLWAPI_H) + || PathMatchSpec(glob.c_str(), ProgramInvocationName()) + || PathMatchSpec(glob.c_str(), ProgramInvocationShortName()) #endif ) { flags_are_relevant = true; |