aboutsummaryrefslogtreecommitdiff
path: root/src/CmakeModule.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/CmakeModule.cpp')
-rw-r--r--src/CmakeModule.cpp34
1 files changed, 32 insertions, 2 deletions
diff --git a/src/CmakeModule.cpp b/src/CmakeModule.cpp
index a690948..f57a8cf 100644
--- a/src/CmakeModule.cpp
+++ b/src/CmakeModule.cpp
@@ -74,6 +74,23 @@ namespace sibs
string allLinkerFlags = "";
#endif
+ if(config.getCompiler() == Compiler::GCC || config.getCompiler() == Compiler::MINGW_W64)
+ {
+ switch(config.getSanitize()) {
+ case Sanitize::NONE:
+ break;
+ case Sanitize::ADDRESS:
+ allLinkerFlags += " -lasan";
+ break;
+ case Sanitize::UNDEFINED:
+ allLinkerFlags += TINYDIR_STRING(" -lubsan");
+ break;
+ case Sanitize::LEAK:
+ allLinkerFlags += TINYDIR_STRING(" -llsan");
+ break;
+ }
+ }
+
#if 0
// TODO: Somehow check loading order, because it has to be correct to work.. Or does it for dynamic libraries?
// Anyways it's required for static libraries (especially on Windows)
@@ -180,9 +197,22 @@ namespace sibs
FileString cflags = TINYDIR_STRING("-fPIC");
FileString cxxflags;
- if(config.getCompiler() == Compiler::GCC && config.getSanitize())
+ if(config.getCompiler() == Compiler::GCC || config.getCompiler() == Compiler::MINGW_W64)
{
- cflags += TINYDIR_STRING(" -fno-omit-frame-pointer -fsanitize=address -fsanitize=undefined -fsanitize=leak -lasan -lubsan -llsan");
+ cflags += TINYDIR_STRING(" -fno-omit-frame-pointer");
+ switch(config.getSanitize()) {
+ case Sanitize::NONE:
+ break;
+ case Sanitize::ADDRESS:
+ cflags += TINYDIR_STRING(" -fsanitize=address");
+ break;
+ case Sanitize::UNDEFINED:
+ cflags += TINYDIR_STRING(" -fsanitize=undefined");
+ break;
+ case Sanitize::LEAK:
+ cflags += TINYDIR_STRING(" -fsanitize=leak");
+ break;
+ }
}
#if OS_FAMILY == OS_FAMILY_POSIX