@@ -42,13 +42,10 @@ else (MSVC)
42
42
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-c++0x-compat" ) # C++ only
43
43
if (CMAKE_COMPILER_IS_GNUCXX)
44
44
# GCC flags
45
- if (SQLITECPP_USE_GCOV AND CMAKE_COMPILER_IS_GNUCXX)
46
- if (CMAKE_BUILD_TYPE STREQUAL "Debug" )
47
- message (STATUS "Using GCov instrumentation" )
48
- else ()
49
- message (WARNING "GCov instrumentation works best in Debug mode" )
50
- endif ()
51
- add_compile_options (-coverage) # NOTE would be usefull but not working with current google test and gcc 4.8 -fkeep-inline-functions
45
+ option (SQLITECPP_USE_GCOV "USE GCov instrumentation." OFF )
46
+ if (SQLITECPP_USE_GCOV)
47
+ message (STATUS "Using GCov instrumentation" )
48
+ add_compile_options (-coverage) # NOTE -fkeep-inline-functions would be usefull but not working with current google test and gcc 4.8
52
49
set (CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -coverage" )
53
50
endif ()
54
51
endif (CMAKE_COMPILER_IS_GNUCXX)
@@ -206,6 +203,18 @@ install(EXPORT ${PROJECT_NAME}Config DESTINATION lib/cmake/${PROJECT_NAME})
206
203
# set_target_properties(SQLiteCpp PROPERTIES COMPILE_FLAGS "-DSQLITECPP_HAS_MEM_STRUCT")
207
204
#endif()
208
205
206
+ option (SQLITECPP_USE_ASAN "Use Address Sanitizer." OFF )
207
+ if (SQLITECPP_USE_ASAN)
208
+ if ((CMAKE_CXX_COMPILER_VERSION GREATER_EQUAL 6) OR ("${CMAKE_CXX_COMPILER_ID} " STREQUAL "Clang" ))
209
+ message (STATUS "Using Address Sanitizer" )
210
+ set_target_properties (SQLiteCpp PROPERTIES COMPILE_FLAGS "-fsanitize=address -fno-omit-frame-pointer" )
211
+ set (CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -fsanitize=address" )
212
+ if (CMAKE_COMPILER_IS_GNUCXX)
213
+ set (CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -fuse-ld=gold" )
214
+ endif ()
215
+ endif ()
216
+ endif (SQLITECPP_USE_ASAN)
217
+
209
218
option (SQLITECPP_INTERNAL_SQLITE "Add the internal SQLite3 source to the project." ON )
210
219
if (SQLITECPP_INTERNAL_SQLITE)
211
220
# build the SQLite3 C library (for ease of use/compatibility) versus Linux sqlite3-dev package
0 commit comments