summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPetr Štetiar <ynezz@true.cz>2020-10-03 00:15:21 +0200
committerPetr Štetiar <ynezz@true.cz>2020-10-03 09:20:48 +0200
commit31f78bfbf75f6b039fd71ddb0988637348f276a6 (patch)
tree709a48309eaebf2dd524893592934d71a769d68f
parenta3e650911f5e6f67dcff09974df3775dfd615da6 (diff)
downloaduci-31f78bfbf75f6b039fd71ddb0988637348f276a6.tar.gz
cmake: add uci-san cli built with clang sanitizers
Will be used for testing. Signed-off-by: Petr Štetiar <ynezz@true.cz>
-rw-r--r--CMakeLists.txt15
1 files changed, 15 insertions, 0 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index da4ac68..560ed65 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -56,6 +56,21 @@ ENDIF()
IF(UNIT_TESTING)
ENABLE_TESTING()
ADD_SUBDIRECTORY(tests)
+
+ IF(CMAKE_C_COMPILER_ID STREQUAL "Clang")
+ ADD_LIBRARY(uci-san SHARED ${LIB_SOURCES})
+ SET_TARGET_PROPERTIES(uci-san PROPERTIES OUTPUT_NAME uci-san)
+ TARGET_COMPILE_OPTIONS(uci-san PRIVATE -g -fno-omit-frame-pointer -fsanitize=undefined,address,leak -fno-sanitize-recover=all)
+ TARGET_LINK_OPTIONS(uci-san PRIVATE -fsanitize=undefined,address,leak)
+ TARGET_LINK_LIBRARIES(uci-san ${ubox})
+
+ ADD_EXECUTABLE(cli-san cli.c)
+ SET_TARGET_PROPERTIES(cli-san PROPERTIES OUTPUT_NAME uci-san)
+ TARGET_COMPILE_OPTIONS(cli-san PRIVATE -g -fno-omit-frame-pointer -fsanitize=undefined,address,leak -fno-sanitize-recover=all)
+ TARGET_LINK_OPTIONS(cli-san PRIVATE -fsanitize=undefined,address,leak)
+ TARGET_LINK_LIBRARIES(cli-san uci-san ${ubox})
+ ENDIF()
+
ENDIF()
INSTALL(FILES uci.h uci_config.h uci_blob.h ucimap.h