Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix gflags windows linker warnings #640

Merged
merged 1 commit into from
Apr 11, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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