From 7f95ecfdc7023ebc8074ad9c71a9e0f095e1eefa Mon Sep 17 00:00:00 2001 From: Andrew Schwartzmeyer Date: Fri, 23 Jun 2017 12:39:49 -0700 Subject: [PATCH] Link to DbgHelp using pre-processor directive This method ensure that all users of glog get automatically linked to the DbgHelp library without needing to set compiler flags. --- CMakeLists.txt | 1 - src/demangle.cc | 1 + src/symbolize.cc | 1 + 3 files changed, 2 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index b8f8bd8..af4680d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -458,7 +458,6 @@ endif (HAVE_EXECINFO_H) if (WIN32) set (HAVE_STACKTRACE 1) set (HAVE_SYMBOLIZE 1) - target_link_libraries (glog PUBLIC Dbghelp.lib) endif (WIN32) if (UNIX OR (APPLE AND HAVE_DLADDR)) diff --git a/src/demangle.cc b/src/demangle.cc index 7852043..4b33580 100644 --- a/src/demangle.cc +++ b/src/demangle.cc @@ -40,6 +40,7 @@ #if defined(OS_WINDOWS) #include +#pragma comment(lib, "DbgHelp") #endif _START_GOOGLE_NAMESPACE_ diff --git a/src/symbolize.cc b/src/symbolize.cc index 24dcddc..953f1db 100644 --- a/src/symbolize.cc +++ b/src/symbolize.cc @@ -840,6 +840,7 @@ _END_GOOGLE_NAMESPACE_ #elif defined(OS_WINDOWS) #include +#pragma comment(lib, "DbgHelp") _START_GOOGLE_NAMESPACE_ -- 2.7.4