diff --git a/CMakeLists.txt b/CMakeLists.txt
index 49a7787..d922ed7 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -24,9 +24,10 @@ include(CheckCXXSourceCompiles)
include(CheckCXXCompilerFlag)
if(PROJECT_IS_TOP_LEVEL)
- find_program(CCACHE_FOUND ccache)
- if(CCACHE_FOUND)
- set_property(GLOBAL PROPERTY RULE_LAUNCH_COMPILE ccache)
+ find_program(CCACHE_PROGRAM ccache)
+ if(CCACHE_PROGRAM)
+ set(CMAKE_C_COMPILER_LAUNCHER ${CCACHE_PROGRAM})
+ set(CMAKE_CXX_COMPILER_LAUNCHER ${CCACHE_PROGRAM})
endif()
endif()
diff --git a/README.md b/README.md
index da0bfbd..60a616c 100644
--- a/README.md
+++ b/README.md
@@ -8,7 +8,7 @@
[](https://godbolt.org/z/c6TqTzqcf)
-Cpptrace is a simple, portable, and self-contained C++ stacktrace library supporting C++11 and greater on Linux, macOS,
+Cpptrace is a simple and portable C++ stacktrace library supporting C++11 and greater on Linux, macOS,
and Windows including MinGW and Cygwin environments. The goal: Make stack traces simple for once.
Cpptrace also has a C API, docs [here](docs/c-api.md).
diff --git a/src/binary/object.cpp b/src/binary/object.cpp
index 0920e42..7f4d524 100644
--- a/src/binary/object.cpp
+++ b/src/binary/object.cpp
@@ -5,6 +5,7 @@
#include "binary/module_base.hpp"
#include
+#include
#include
#include
#include
@@ -16,7 +17,9 @@
#include // needed for dladdr1's link_map info
#endif
#elif IS_WINDOWS
- #define WIN32_LEAN_AND_MEAN
+ #ifndef WIN32_LEAN_AND_MEAN
+ #define WIN32_LEAN_AND_MEAN
+ #endif
#include
#endif
diff --git a/src/binary/pe.cpp b/src/binary/pe.cpp
index 107084a..dc0b728 100644
--- a/src/binary/pe.cpp
+++ b/src/binary/pe.cpp
@@ -10,7 +10,9 @@
#include
#include
-#define WIN32_LEAN_AND_MEAN
+#ifndef WIN32_LEAN_AND_MEAN
+ #define WIN32_LEAN_AND_MEAN
+#endif
#include
namespace cpptrace {
diff --git a/src/demangle/demangle_with_winapi.cpp b/src/demangle/demangle_with_winapi.cpp
index 6bfd576..5d702c4 100644
--- a/src/demangle/demangle_with_winapi.cpp
+++ b/src/demangle/demangle_with_winapi.cpp
@@ -4,7 +4,9 @@
#include
-#define WIN32_LEAN_AND_MEAN
+#ifndef WIN32_LEAN_AND_MEAN
+ #define WIN32_LEAN_AND_MEAN
+#endif
#include
#include
diff --git a/src/from_current.cpp b/src/from_current.cpp
index d45c551..d099a76 100644
--- a/src/from_current.cpp
+++ b/src/from_current.cpp
@@ -11,7 +11,9 @@
#ifndef _MSC_VER
#include
#if IS_WINDOWS
- #define WIN32_LEAN_AND_MEAN
+ #ifndef WIN32_LEAN_AND_MEAN
+ #define WIN32_LEAN_AND_MEAN
+ #endif
#include
#else
#include
diff --git a/src/platform/dbghelp_syminit_manager.cpp b/src/platform/dbghelp_syminit_manager.cpp
index 774db78..e11f866 100644
--- a/src/platform/dbghelp_syminit_manager.cpp
+++ b/src/platform/dbghelp_syminit_manager.cpp
@@ -9,7 +9,9 @@
#include
-#define WIN32_LEAN_AND_MEAN
+#ifndef WIN32_LEAN_AND_MEAN
+ #define WIN32_LEAN_AND_MEAN
+#endif
#include
#include
diff --git a/src/platform/path.hpp b/src/platform/path.hpp
index afb6775..849ad66 100644
--- a/src/platform/path.hpp
+++ b/src/platform/path.hpp
@@ -7,7 +7,9 @@
#include
#if IS_WINDOWS
-#define WIN32_LEAN_AND_MEAN
+#ifndef WIN32_LEAN_AND_MEAN
+ #define WIN32_LEAN_AND_MEAN
+#endif
#include
#endif
diff --git a/src/platform/program_name.hpp b/src/platform/program_name.hpp
index 7d22cda..e5dafac 100644
--- a/src/platform/program_name.hpp
+++ b/src/platform/program_name.hpp
@@ -7,7 +7,9 @@
#include "platform/platform.hpp"
#if IS_WINDOWS
-#define WIN32_LEAN_AND_MEAN
+#ifndef WIN32_LEAN_AND_MEAN
+ #define WIN32_LEAN_AND_MEAN
+#endif
#include
#define CPPTRACE_MAX_PATH MAX_PATH
diff --git a/src/symbols/symbols_with_dbghelp.cpp b/src/symbols/symbols_with_dbghelp.cpp
index 7bb05e2..0e665a9 100644
--- a/src/symbols/symbols_with_dbghelp.cpp
+++ b/src/symbols/symbols_with_dbghelp.cpp
@@ -12,7 +12,9 @@
#include
#include
-#define WIN32_LEAN_AND_MEAN
+#ifndef WIN32_LEAN_AND_MEAN
+ #define WIN32_LEAN_AND_MEAN
+#endif
#include
#include
diff --git a/src/unwind/unwind_with_winapi.cpp b/src/unwind/unwind_with_winapi.cpp
index 75ec5a1..2dd59b3 100644
--- a/src/unwind/unwind_with_winapi.cpp
+++ b/src/unwind/unwind_with_winapi.cpp
@@ -9,7 +9,9 @@
#include
#include
-#define WIN32_LEAN_AND_MEAN
+#ifndef WIN32_LEAN_AND_MEAN
+ #define WIN32_LEAN_AND_MEAN
+#endif
#include
// Fucking windows headers
diff --git a/src/utils/microfmt.hpp b/src/utils/microfmt.hpp
index 46876b2..2cf0b80 100644
--- a/src/utils/microfmt.hpp
+++ b/src/utils/microfmt.hpp
@@ -1,6 +1,7 @@
#ifndef MICROFMT_HPP
#define MICROFMT_HPP
+#include
#include
#include
#include
diff --git a/src/utils/utils.cpp b/src/utils/utils.cpp
index 80de344..4a2061e 100644
--- a/src/utils/utils.cpp
+++ b/src/utils/utils.cpp
@@ -2,7 +2,9 @@
#if IS_WINDOWS
#include
- #define WIN32_LEAN_AND_MEAN
+ #ifndef WIN32_LEAN_AND_MEAN
+ #define WIN32_LEAN_AND_MEAN
+ #endif
#include
#else
#include