ASan + install shared library v_0 v0.15
authorFrantišek Kučera <franta-hg@frantovo.cz>
Fri, 31 Jan 2020 22:57:10 +0100
branchv_0
changeset 22 86b7c37425f3
parent 21 c4e54e9be412
child 23 618388c50338
ASan + install shared library
src/CMakeLists.txt
--- a/src/CMakeLists.txt	Fri Dec 13 22:19:39 2019 +0100
+++ b/src/CMakeLists.txt	Fri Jan 31 22:57:10 2020 +0100
@@ -18,6 +18,11 @@
 
 set(LIBRARY_FILE ${PROJECT_CODE}.cpp)
 
+# Add ASan AddressSanitizer
+set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -fno-omit-frame-pointer -fsanitize=address")
+set(CMAKE_LINKER_FLAGS_DEBUG "${CMAKE_LINKER_FLAGS_DEBUG} -fno-omit-frame-pointer -fsanitize=address")
+# From ASan wiki: "To get nicer stack traces in error messages add -fno-omit-frame-pointer."
+
 configure_file("pkg-config.cpp.pc.in" "${PROJECT_CODE}.cpp.pc" @ONLY)
 
 # Library output:
@@ -29,5 +34,6 @@
 	${PROJECT_CODE}.cpp
 )
 
+install(TARGETS ${LIBRARY_FILE} DESTINATION lib/relpipe) # TODO: add version and symlink
 install(FILES "${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_CODE}.cpp.pc" DESTINATION ${CMAKE_INSTALL_PREFIX}/lib/pkgconfig/)
-install(DIRECTORY ../include/ DESTINATION include)
+install(DIRECTORY ../include/ DESTINATION include)
\ No newline at end of file