Skip to content

Commit

Permalink
eliminated gflags related linker warnings (google#569)
Browse files Browse the repository at this point in the history
  • Loading branch information
sergiud committed Apr 11, 2021
1 parent 7d4eeb1 commit 762a2a7
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 5 deletions.
8 changes: 4 additions & 4 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -583,10 +583,10 @@ endif (HAVE_PTHREAD)
if (gflags_FOUND)
target_link_libraries (glog PUBLIC gflags)

if (NOT BUILD_SHARED_LIBS)
# Don't use __declspec(dllexport|dllimport) if this is a static build
targeT_compile_definitions (glog PUBLIC GFLAGS_DLL_DECLARE_FLAG= GFLAGS_DLL_DEFINE_FLAG=)
endif (NOT BUILD_SHARED_LIBS)
target_compile_definitions (glog PRIVATE
GFLAGS_DLL_DECLARE_FLAG=GOOGLE_GLOG_DLL_DECL
GFLAGS_DLL_DEFINE_FLAG=GOOGLE_GLOG_DLL_DECL
)
endif (gflags_FOUND)

if (ANDROID)
Expand Down
13 changes: 13 additions & 0 deletions src/glog/logging.h.in
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,14 @@
#include <inttypes.h> // a third place for uint16_t or u_int16_t
#endif

#ifdef GFLAGS_DLL_DECLARE_FLAG
#define GLOG_GFLAGS_DLL_DECLARE_FLAG_WAS_DEFINED
#pragma push_macro("GFLAGS_DLL_DECLARE_FLAG")
#undef GFLAGS_DLL_DECLARE_FLAG
#endif // defined(GFLAGS_DLL_DECLARE_FLAG)

#define GFLAGS_DLL_DECLARE_FLAG GOOGLE_GLOG_DLL_DECL

#if @ac_cv_have_libgflags@
#include <gflags/gflags.h>
#endif
Expand Down Expand Up @@ -1876,4 +1884,9 @@ GOOGLE_GLOG_DLL_DECL void InstallFailureWriter(

@ac_google_end_namespace@

#ifdef GLOG_GFLAGS_DLL_DECLARE_FLAG_WAS_DEFINED
#undef GLOG_GFLAGS_DLL_DECLARE_FLAG_WAS_DEFINED
#pragma pop_macro("GFLAGS_DLL_DECLARE_FLAG")
#endif // defined(GLOG_GFLAGS_DLL_DECLARE_FLAG_WAS_DEFINED)

#endif // _LOGGING_H_
1 change: 0 additions & 1 deletion src/logging_custom_prefix_unittest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@
//
// Author: Ray Sidney

#include "config_for_unittests.h"
#include "utilities.h"

#include <fcntl.h>
Expand Down

0 comments on commit 762a2a7

Please sign in to comment.